| 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 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2236 } | 2236 } |
| 2237 | 2237 |
| 2238 HConstant* elements_size_value = Add<HConstant>(elements_size); | 2238 HConstant* elements_size_value = Add<HConstant>(elements_size); |
| 2239 HValue* mul = AddUncasted<HMul>(capacity, elements_size_value); | 2239 HValue* mul = AddUncasted<HMul>(capacity, elements_size_value); |
| 2240 mul->ClearFlag(HValue::kCanOverflow); | 2240 mul->ClearFlag(HValue::kCanOverflow); |
| 2241 | 2241 |
| 2242 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); | 2242 HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize); |
| 2243 HValue* total_size = AddUncasted<HAdd>(mul, header_size); | 2243 HValue* total_size = AddUncasted<HAdd>(mul, header_size); |
| 2244 total_size->ClearFlag(HValue::kCanOverflow); | 2244 total_size->ClearFlag(HValue::kCanOverflow); |
| 2245 | 2245 |
| 2246 return Add<HAllocate>(total_size, HType::JSArray(), | 2246 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? |
| 2247 isolate()->heap()->GetPretenureMode(), instance_type); | 2247 isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
| 2248 |
| 2249 return Add<HAllocate>(total_size, HType::JSArray(), pretenure_flag, |
| 2250 instance_type); |
| 2248 } | 2251 } |
| 2249 | 2252 |
| 2250 | 2253 |
| 2251 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, | 2254 void HGraphBuilder::BuildInitializeElementsHeader(HValue* elements, |
| 2252 ElementsKind kind, | 2255 ElementsKind kind, |
| 2253 HValue* capacity) { | 2256 HValue* capacity) { |
| 2254 Factory* factory = isolate()->factory(); | 2257 Factory* factory = isolate()->factory(); |
| 2255 Handle<Map> map = IsFastDoubleElementsKind(kind) | 2258 Handle<Map> map = IsFastDoubleElementsKind(kind) |
| 2256 ? factory->fixed_double_array_map() | 2259 ? factory->fixed_double_array_map() |
| 2257 : factory->fixed_array_map(); | 2260 : factory->fixed_array_map(); |
| (...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5251 bool transition_to_field = lookup->IsTransitionToField(*map); | 5254 bool transition_to_field = lookup->IsTransitionToField(*map); |
| 5252 | 5255 |
| 5253 HStoreNamedField *instr; | 5256 HStoreNamedField *instr; |
| 5254 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { | 5257 if (FLAG_track_double_fields && field_access.representation().IsDouble()) { |
| 5255 HObjectAccess heap_number_access = | 5258 HObjectAccess heap_number_access = |
| 5256 field_access.WithRepresentation(Representation::Tagged()); | 5259 field_access.WithRepresentation(Representation::Tagged()); |
| 5257 if (transition_to_field) { | 5260 if (transition_to_field) { |
| 5258 // The store requires a mutable HeapNumber to be allocated. | 5261 // The store requires a mutable HeapNumber to be allocated. |
| 5259 NoObservableSideEffectsScope no_side_effects(this); | 5262 NoObservableSideEffectsScope no_side_effects(this); |
| 5260 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 5263 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
| 5264 |
| 5265 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? |
| 5266 isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
| 5267 |
| 5261 HInstruction* heap_number = Add<HAllocate>(heap_number_size, | 5268 HInstruction* heap_number = Add<HAllocate>(heap_number_size, |
| 5262 HType::HeapNumber(), isolate()->heap()->GetPretenureMode(), | 5269 HType::HeapNumber(), |
| 5270 pretenure_flag, |
| 5263 HEAP_NUMBER_TYPE); | 5271 HEAP_NUMBER_TYPE); |
| 5264 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); | 5272 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); |
| 5265 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), | 5273 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), |
| 5266 value); | 5274 value); |
| 5267 instr = New<HStoreNamedField>(checked_object->ActualValue(), | 5275 instr = New<HStoreNamedField>(checked_object->ActualValue(), |
| 5268 heap_number_access, | 5276 heap_number_access, |
| 5269 heap_number); | 5277 heap_number); |
| 5270 } else { | 5278 } else { |
| 5271 // Already holds a HeapNumber; load the box and write its value field. | 5279 // Already holds a HeapNumber; load the box and write its value field. |
| 5272 HInstruction* heap_number = Add<HLoadNamedField>(checked_object, | 5280 HInstruction* heap_number = Add<HLoadNamedField>(checked_object, |
| (...skipping 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8166 | 8174 |
| 8167 // Calculate instance size from initial map of constructor. | 8175 // Calculate instance size from initial map of constructor. |
| 8168 ASSERT(constructor->has_initial_map()); | 8176 ASSERT(constructor->has_initial_map()); |
| 8169 Handle<Map> initial_map(constructor->initial_map()); | 8177 Handle<Map> initial_map(constructor->initial_map()); |
| 8170 int instance_size = initial_map->instance_size(); | 8178 int instance_size = initial_map->instance_size(); |
| 8171 ASSERT(initial_map->InitialPropertiesLength() == 0); | 8179 ASSERT(initial_map->InitialPropertiesLength() == 0); |
| 8172 | 8180 |
| 8173 // Allocate an instance of the implicit receiver object. | 8181 // Allocate an instance of the implicit receiver object. |
| 8174 HValue* size_in_bytes = Add<HConstant>(instance_size); | 8182 HValue* size_in_bytes = Add<HConstant>(instance_size); |
| 8175 PretenureFlag pretenure_flag = | 8183 PretenureFlag pretenure_flag = |
| 8176 (FLAG_pretenuring_call_new && | 8184 (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ? |
| 8177 isolate()->heap()->GetPretenureMode() == TENURED) | 8185 isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
| 8178 ? TENURED : NOT_TENURED; | |
| 8179 HAllocate* receiver = | 8186 HAllocate* receiver = |
| 8180 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, | 8187 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, |
| 8181 JS_OBJECT_TYPE); | 8188 JS_OBJECT_TYPE); |
| 8182 receiver->set_known_initial_map(initial_map); | 8189 receiver->set_known_initial_map(initial_map); |
| 8183 | 8190 |
| 8184 // Load the initial map from the constructor. | 8191 // Load the initial map from the constructor. |
| 8185 HValue* constructor_value = Add<HConstant>(constructor); | 8192 HValue* constructor_value = Add<HConstant>(constructor); |
| 8186 HValue* initial_map_value = | 8193 HValue* initial_map_value = |
| 8187 Add<HLoadNamedField>(constructor_value, HObjectAccess::ForJSObjectOffset( | 8194 Add<HLoadNamedField>(constructor_value, HObjectAccess::ForJSObjectOffset( |
| 8188 JSFunction::kPrototypeOrInitialMapOffset)); | 8195 JSFunction::kPrototypeOrInitialMapOffset)); |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8931 HValue* HOptimizedGraphBuilder::BuildBinaryOperation( | 8938 HValue* HOptimizedGraphBuilder::BuildBinaryOperation( |
| 8932 BinaryOperation* expr, | 8939 BinaryOperation* expr, |
| 8933 HValue* left, | 8940 HValue* left, |
| 8934 HValue* right) { | 8941 HValue* right) { |
| 8935 Type* left_type = expr->left()->bounds().lower; | 8942 Type* left_type = expr->left()->bounds().lower; |
| 8936 Type* right_type = expr->right()->bounds().lower; | 8943 Type* right_type = expr->right()->bounds().lower; |
| 8937 Type* result_type = expr->bounds().lower; | 8944 Type* result_type = expr->bounds().lower; |
| 8938 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); | 8945 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); |
| 8939 Handle<AllocationSite> allocation_site = expr->allocation_site(); | 8946 Handle<AllocationSite> allocation_site = expr->allocation_site(); |
| 8940 | 8947 |
| 8948 PretenureFlag pretenure_flag = !FLAG_allocation_site_pretenuring ? |
| 8949 isolate()->heap()->GetPretenureMode() : NOT_TENURED; |
| 8950 |
| 8941 HAllocationMode allocation_mode = | 8951 HAllocationMode allocation_mode = |
| 8942 FLAG_allocation_site_pretenuring | 8952 FLAG_allocation_site_pretenuring |
| 8943 ? (allocation_site.is_null() | 8953 ? (allocation_site.is_null() |
| 8944 ? HAllocationMode(NOT_TENURED) | 8954 ? HAllocationMode(NOT_TENURED) |
| 8945 : HAllocationMode(allocation_site)) | 8955 : HAllocationMode(allocation_site)) |
| 8946 : HAllocationMode(isolate()->heap()->GetPretenureMode()); | 8956 : HAllocationMode(pretenure_flag); |
| 8947 | 8957 |
| 8948 HValue* result = HGraphBuilder::BuildBinaryOperation( | 8958 HValue* result = HGraphBuilder::BuildBinaryOperation( |
| 8949 expr->op(), left, right, left_type, right_type, result_type, | 8959 expr->op(), left, right, left_type, right_type, result_type, |
| 8950 fixed_right_arg, allocation_mode); | 8960 fixed_right_arg, allocation_mode); |
| 8951 // Add a simulate after instructions with observable side effects, and | 8961 // Add a simulate after instructions with observable side effects, and |
| 8952 // after phis, which are the result of BuildBinaryOperation when we | 8962 // after phis, which are the result of BuildBinaryOperation when we |
| 8953 // inlined some complex subgraph. | 8963 // inlined some complex subgraph. |
| 8954 if (result->HasObservableSideEffects() || result->IsPhi()) { | 8964 if (result->HasObservableSideEffects() || result->IsPhi()) { |
| 8955 Push(result); | 8965 Push(result); |
| 8956 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 8966 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
| (...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11083 if (ShouldProduceTraceOutput()) { | 11093 if (ShouldProduceTraceOutput()) { |
| 11084 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11094 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11085 } | 11095 } |
| 11086 | 11096 |
| 11087 #ifdef DEBUG | 11097 #ifdef DEBUG |
| 11088 graph_->Verify(false); // No full verify. | 11098 graph_->Verify(false); // No full verify. |
| 11089 #endif | 11099 #endif |
| 11090 } | 11100 } |
| 11091 | 11101 |
| 11092 } } // namespace v8::internal | 11102 } } // namespace v8::internal |
| OLD | NEW |