| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 8207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8218 // Checks whether allocation using the given constructor can be inlined. | 8218 // Checks whether allocation using the given constructor can be inlined. |
| 8219 static bool IsAllocationInlineable(Handle<JSFunction> constructor) { | 8219 static bool IsAllocationInlineable(Handle<JSFunction> constructor) { |
| 8220 return constructor->has_initial_map() && | 8220 return constructor->has_initial_map() && |
| 8221 constructor->initial_map()->instance_type() == JS_OBJECT_TYPE && | 8221 constructor->initial_map()->instance_type() == JS_OBJECT_TYPE && |
| 8222 constructor->initial_map()->instance_size() < HAllocate::kMaxInlineSize && | 8222 constructor->initial_map()->instance_size() < HAllocate::kMaxInlineSize && |
| 8223 constructor->initial_map()->InitialPropertiesLength() == 0; | 8223 constructor->initial_map()->InitialPropertiesLength() == 0; |
| 8224 } | 8224 } |
| 8225 | 8225 |
| 8226 | 8226 |
| 8227 bool HOptimizedGraphBuilder::IsCallNewArrayInlineable(CallNew* expr) { | 8227 bool HOptimizedGraphBuilder::IsCallNewArrayInlineable(CallNew* expr) { |
| 8228 Handle<AllocationSite> site = expr->allocation_site(); | |
| 8229 if (site.is_null()) return false; | |
| 8230 | |
| 8231 Handle<JSFunction> caller = current_info()->closure(); | 8228 Handle<JSFunction> caller = current_info()->closure(); |
| 8232 Handle<JSFunction> target(isolate()->native_context()->array_function(), | 8229 Handle<JSFunction> target(isolate()->native_context()->array_function(), |
| 8233 isolate()); | 8230 isolate()); |
| 8234 int argument_count = expr->arguments()->length(); | 8231 int argument_count = expr->arguments()->length(); |
| 8235 // We should have the function plus array arguments on the environment stack. | 8232 // We should have the function plus array arguments on the environment stack. |
| 8236 ASSERT(environment()->length() >= (argument_count + 1)); | 8233 ASSERT(environment()->length() >= (argument_count + 1)); |
| 8234 Handle<AllocationSite> site = expr->allocation_site(); |
| 8235 ASSERT(!site.is_null()); |
| 8237 | 8236 |
| 8238 bool inline_ok = false; | 8237 bool inline_ok = false; |
| 8239 if (site->CanInlineCall()) { | 8238 if (site->CanInlineCall()) { |
| 8240 // We also want to avoid inlining in certain 1 argument scenarios. | 8239 // We also want to avoid inlining in certain 1 argument scenarios. |
| 8241 if (argument_count == 1) { | 8240 if (argument_count == 1) { |
| 8242 HValue* argument = Top(); | 8241 HValue* argument = Top(); |
| 8243 if (argument->IsConstant()) { | 8242 if (argument->IsConstant()) { |
| 8244 // Do not inline if the constant length argument is not a smi or | 8243 // Do not inline if the constant length argument is not a smi or |
| 8245 // outside the valid range for a fast array. | 8244 // outside the valid range for a fast array. |
| 8246 HConstant* constant_argument = HConstant::cast(argument); | 8245 HConstant* constant_argument = HConstant::cast(argument); |
| (...skipping 3052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11299 if (ShouldProduceTraceOutput()) { | 11298 if (ShouldProduceTraceOutput()) { |
| 11300 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11299 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11301 } | 11300 } |
| 11302 | 11301 |
| 11303 #ifdef DEBUG | 11302 #ifdef DEBUG |
| 11304 graph_->Verify(false); // No full verify. | 11303 graph_->Verify(false); // No full verify. |
| 11305 #endif | 11304 #endif |
| 11306 } | 11305 } |
| 11307 | 11306 |
| 11308 } } // namespace v8::internal | 11307 } } // namespace v8::internal |
| OLD | NEW |