| 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 <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 9538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9549 | 9549 |
| 9550 int args_to_drop = argument_count + (expression->IsCall() ? 2 : 1); | 9550 int args_to_drop = argument_count + (expression->IsCall() ? 2 : 1); |
| 9551 Drop(args_to_drop); | 9551 Drop(args_to_drop); |
| 9552 ast_context()->ReturnValue(new_object); | 9552 ast_context()->ReturnValue(new_object); |
| 9553 } | 9553 } |
| 9554 | 9554 |
| 9555 | 9555 |
| 9556 // Checks whether allocation using the given constructor can be inlined. | 9556 // Checks whether allocation using the given constructor can be inlined. |
| 9557 static bool IsAllocationInlineable(Handle<JSFunction> constructor) { | 9557 static bool IsAllocationInlineable(Handle<JSFunction> constructor) { |
| 9558 return constructor->has_initial_map() && | 9558 return constructor->has_initial_map() && |
| 9559 constructor->initial_map()->instance_type() == JS_OBJECT_TYPE && | 9559 constructor->initial_map()->instance_type() == JS_OBJECT_TYPE && |
| 9560 constructor->initial_map()->instance_size() < HAllocate::kMaxInlineSize && | 9560 constructor->initial_map()->instance_size() < |
| 9561 constructor->initial_map()->InitialPropertiesLength() == 0; | 9561 HAllocate::kMaxInlineSize; |
| 9562 } | 9562 } |
| 9563 | 9563 |
| 9564 | 9564 |
| 9565 bool HOptimizedGraphBuilder::IsCallArrayInlineable( | 9565 bool HOptimizedGraphBuilder::IsCallArrayInlineable( |
| 9566 int argument_count, | 9566 int argument_count, |
| 9567 Handle<AllocationSite> site) { | 9567 Handle<AllocationSite> site) { |
| 9568 Handle<JSFunction> caller = current_info()->closure(); | 9568 Handle<JSFunction> caller = current_info()->closure(); |
| 9569 Handle<JSFunction> target = array_function(); | 9569 Handle<JSFunction> target = array_function(); |
| 9570 // We should have the function plus array arguments on the environment stack. | 9570 // We should have the function plus array arguments on the environment stack. |
| 9571 DCHECK(environment()->length() >= (argument_count + 1)); | 9571 DCHECK(environment()->length() >= (argument_count + 1)); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9637 // Force completion of inobject slack tracking before generating | 9637 // Force completion of inobject slack tracking before generating |
| 9638 // allocation code to finalize instance size. | 9638 // allocation code to finalize instance size. |
| 9639 if (constructor->IsInobjectSlackTrackingInProgress()) { | 9639 if (constructor->IsInobjectSlackTrackingInProgress()) { |
| 9640 constructor->CompleteInobjectSlackTracking(); | 9640 constructor->CompleteInobjectSlackTracking(); |
| 9641 } | 9641 } |
| 9642 | 9642 |
| 9643 // Calculate instance size from initial map of constructor. | 9643 // Calculate instance size from initial map of constructor. |
| 9644 DCHECK(constructor->has_initial_map()); | 9644 DCHECK(constructor->has_initial_map()); |
| 9645 Handle<Map> initial_map(constructor->initial_map()); | 9645 Handle<Map> initial_map(constructor->initial_map()); |
| 9646 int instance_size = initial_map->instance_size(); | 9646 int instance_size = initial_map->instance_size(); |
| 9647 DCHECK(initial_map->InitialPropertiesLength() == 0); | |
| 9648 | 9647 |
| 9649 // Allocate an instance of the implicit receiver object. | 9648 // Allocate an instance of the implicit receiver object. |
| 9650 HValue* size_in_bytes = Add<HConstant>(instance_size); | 9649 HValue* size_in_bytes = Add<HConstant>(instance_size); |
| 9651 HAllocationMode allocation_mode; | 9650 HAllocationMode allocation_mode; |
| 9652 if (FLAG_pretenuring_call_new) { | 9651 if (FLAG_pretenuring_call_new) { |
| 9653 if (FLAG_allocation_site_pretenuring) { | 9652 if (FLAG_allocation_site_pretenuring) { |
| 9654 // Try to use pretenuring feedback. | 9653 // Try to use pretenuring feedback. |
| 9655 Handle<AllocationSite> allocation_site = expr->allocation_site(); | 9654 Handle<AllocationSite> allocation_site = expr->allocation_site(); |
| 9656 allocation_mode = HAllocationMode(allocation_site); | 9655 allocation_mode = HAllocationMode(allocation_site); |
| 9657 // Take a dependency on allocation site. | 9656 // Take a dependency on allocation site. |
| (...skipping 3587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13245 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13244 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13246 } | 13245 } |
| 13247 | 13246 |
| 13248 #ifdef DEBUG | 13247 #ifdef DEBUG |
| 13249 graph_->Verify(false); // No full verify. | 13248 graph_->Verify(false); // No full verify. |
| 13250 #endif | 13249 #endif |
| 13251 } | 13250 } |
| 13252 | 13251 |
| 13253 } // namespace internal | 13252 } // namespace internal |
| 13254 } // namespace v8 | 13253 } // namespace v8 |
| OLD | NEW |