| 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
| (...skipping 6037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6048 | 6048 |
| 6049 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); | 6049 Handle<JSFunction> closure = function_state()->compilation_info()->closure(); |
| 6050 HInstruction* literal; | 6050 HInstruction* literal; |
| 6051 | 6051 |
| 6052 // Check whether to use fast or slow deep-copying for boilerplate. | 6052 // Check whether to use fast or slow deep-copying for boilerplate. |
| 6053 int max_properties = kMaxFastLiteralProperties; | 6053 int max_properties = kMaxFastLiteralProperties; |
| 6054 Handle<Object> literals_cell( | 6054 Handle<Object> literals_cell( |
| 6055 closure->literals()->literal(expr->literal_index()), isolate()); | 6055 closure->literals()->literal(expr->literal_index()), isolate()); |
| 6056 Handle<AllocationSite> site; | 6056 Handle<AllocationSite> site; |
| 6057 Handle<JSObject> boilerplate; | 6057 Handle<JSObject> boilerplate; |
| 6058 if (!literals_cell->IsUndefined()) { | 6058 if (!literals_cell->IsUndefined(isolate())) { |
| 6059 // Retrieve the boilerplate | 6059 // Retrieve the boilerplate |
| 6060 site = Handle<AllocationSite>::cast(literals_cell); | 6060 site = Handle<AllocationSite>::cast(literals_cell); |
| 6061 boilerplate = Handle<JSObject>(JSObject::cast(site->transition_info()), | 6061 boilerplate = Handle<JSObject>(JSObject::cast(site->transition_info()), |
| 6062 isolate()); | 6062 isolate()); |
| 6063 } | 6063 } |
| 6064 | 6064 |
| 6065 if (!boilerplate.is_null() && | 6065 if (!boilerplate.is_null() && |
| 6066 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { | 6066 IsFastLiteral(boilerplate, kMaxFastLiteralDepth, &max_properties)) { |
| 6067 AllocationSiteUsageContext site_context(isolate(), site, false); | 6067 AllocationSiteUsageContext site_context(isolate(), site, false); |
| 6068 site_context.EnterNewScope(); | 6068 site_context.EnterNewScope(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6166 ZoneList<Expression*>* subexprs = expr->values(); | 6166 ZoneList<Expression*>* subexprs = expr->values(); |
| 6167 int length = subexprs->length(); | 6167 int length = subexprs->length(); |
| 6168 HInstruction* literal; | 6168 HInstruction* literal; |
| 6169 | 6169 |
| 6170 Handle<AllocationSite> site; | 6170 Handle<AllocationSite> site; |
| 6171 Handle<LiteralsArray> literals(environment()->closure()->literals(), | 6171 Handle<LiteralsArray> literals(environment()->closure()->literals(), |
| 6172 isolate()); | 6172 isolate()); |
| 6173 Handle<Object> literals_cell(literals->literal(expr->literal_index()), | 6173 Handle<Object> literals_cell(literals->literal(expr->literal_index()), |
| 6174 isolate()); | 6174 isolate()); |
| 6175 Handle<JSObject> boilerplate_object; | 6175 Handle<JSObject> boilerplate_object; |
| 6176 if (!literals_cell->IsUndefined()) { | 6176 if (!literals_cell->IsUndefined(isolate())) { |
| 6177 DCHECK(literals_cell->IsAllocationSite()); | 6177 DCHECK(literals_cell->IsAllocationSite()); |
| 6178 site = Handle<AllocationSite>::cast(literals_cell); | 6178 site = Handle<AllocationSite>::cast(literals_cell); |
| 6179 boilerplate_object = Handle<JSObject>( | 6179 boilerplate_object = Handle<JSObject>( |
| 6180 JSObject::cast(site->transition_info()), isolate()); | 6180 JSObject::cast(site->transition_info()), isolate()); |
| 6181 } | 6181 } |
| 6182 | 6182 |
| 6183 // Check whether to use fast or slow deep-copying for boilerplate. | 6183 // Check whether to use fast or slow deep-copying for boilerplate. |
| 6184 int max_properties = kMaxFastLiteralProperties; | 6184 int max_properties = kMaxFastLiteralProperties; |
| 6185 if (!boilerplate_object.is_null() && | 6185 if (!boilerplate_object.is_null() && |
| 6186 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, | 6186 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, |
| (...skipping 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9445 break; | 9445 break; |
| 9446 case CallOptimization::kHolderIsReceiver: | 9446 case CallOptimization::kHolderIsReceiver: |
| 9447 holder = receiver; | 9447 holder = receiver; |
| 9448 break; | 9448 break; |
| 9449 case CallOptimization::kHolderNotFound: | 9449 case CallOptimization::kHolderNotFound: |
| 9450 UNREACHABLE(); | 9450 UNREACHABLE(); |
| 9451 break; | 9451 break; |
| 9452 } | 9452 } |
| 9453 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); | 9453 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); |
| 9454 Handle<Object> call_data_obj(api_call_info->data(), isolate()); | 9454 Handle<Object> call_data_obj(api_call_info->data(), isolate()); |
| 9455 bool call_data_undefined = call_data_obj->IsUndefined(); | 9455 bool call_data_undefined = call_data_obj->IsUndefined(isolate()); |
| 9456 HValue* call_data = Add<HConstant>(call_data_obj); | 9456 HValue* call_data = Add<HConstant>(call_data_obj); |
| 9457 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); | 9457 ApiFunction fun(v8::ToCData<Address>(api_call_info->callback())); |
| 9458 ExternalReference ref = ExternalReference(&fun, | 9458 ExternalReference ref = ExternalReference(&fun, |
| 9459 ExternalReference::DIRECT_API_CALL, | 9459 ExternalReference::DIRECT_API_CALL, |
| 9460 isolate()); | 9460 isolate()); |
| 9461 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); | 9461 HValue* api_function_address = Add<HConstant>(ExternalReference(ref)); |
| 9462 | 9462 |
| 9463 HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder, | 9463 HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder, |
| 9464 api_function_address, nullptr}; | 9464 api_function_address, nullptr}; |
| 9465 | 9465 |
| (...skipping 4177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13643 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13643 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13644 } | 13644 } |
| 13645 | 13645 |
| 13646 #ifdef DEBUG | 13646 #ifdef DEBUG |
| 13647 graph_->Verify(false); // No full verify. | 13647 graph_->Verify(false); // No full verify. |
| 13648 #endif | 13648 #endif |
| 13649 } | 13649 } |
| 13650 | 13650 |
| 13651 } // namespace internal | 13651 } // namespace internal |
| 13652 } // namespace v8 | 13652 } // namespace v8 |
| OLD | NEW |