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 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2697 | 2697 |
2698 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, | 2698 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, |
2699 ElementsKind kind, | 2699 ElementsKind kind, |
2700 HValue* allocation_site_payload, | 2700 HValue* allocation_site_payload, |
2701 HValue* constructor_function, | 2701 HValue* constructor_function, |
2702 AllocationSiteOverrideMode override_mode) : | 2702 AllocationSiteOverrideMode override_mode) : |
2703 builder_(builder), | 2703 builder_(builder), |
2704 kind_(kind), | 2704 kind_(kind), |
2705 allocation_site_payload_(allocation_site_payload), | 2705 allocation_site_payload_(allocation_site_payload), |
2706 constructor_function_(constructor_function) { | 2706 constructor_function_(constructor_function) { |
| 2707 ASSERT(!allocation_site_payload->IsConstant() || |
| 2708 HConstant::cast(allocation_site_payload)->handle( |
| 2709 builder_->isolate())->IsAllocationSite()); |
2707 mode_ = override_mode == DISABLE_ALLOCATION_SITES | 2710 mode_ = override_mode == DISABLE_ALLOCATION_SITES |
2708 ? DONT_TRACK_ALLOCATION_SITE | 2711 ? DONT_TRACK_ALLOCATION_SITE |
2709 : AllocationSite::GetMode(kind); | 2712 : AllocationSite::GetMode(kind); |
2710 } | 2713 } |
2711 | 2714 |
2712 | 2715 |
2713 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, | 2716 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, |
2714 ElementsKind kind, | 2717 ElementsKind kind, |
2715 HValue* constructor_function) : | 2718 HValue* constructor_function) : |
2716 builder_(builder), | 2719 builder_(builder), |
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7937 NoObservableSideEffectsScope no_effects(this); | 7940 NoObservableSideEffectsScope no_effects(this); |
7938 | 7941 |
7939 int argument_count = expr->arguments()->length(); | 7942 int argument_count = expr->arguments()->length(); |
7940 // We should at least have the constructor on the expression stack. | 7943 // We should at least have the constructor on the expression stack. |
7941 HValue* constructor = environment()->ExpressionStackAt(argument_count); | 7944 HValue* constructor = environment()->ExpressionStackAt(argument_count); |
7942 | 7945 |
7943 ElementsKind kind = expr->elements_kind(); | 7946 ElementsKind kind = expr->elements_kind(); |
7944 Handle<Cell> cell = expr->allocation_info_cell(); | 7947 Handle<Cell> cell = expr->allocation_info_cell(); |
7945 Handle<AllocationSite> site(AllocationSite::cast(cell->value())); | 7948 Handle<AllocationSite> site(AllocationSite::cast(cell->value())); |
7946 | 7949 |
7947 // Register on the site for deoptimization if the cell value changes. | 7950 // Register on the site for deoptimization if the transition feedback changes. |
7948 AllocationSite::AddDependentCompilationInfo( | 7951 AllocationSite::AddDependentCompilationInfo( |
7949 site, AllocationSite::TRANSITIONS, top_info()); | 7952 site, AllocationSite::TRANSITIONS, top_info()); |
7950 HInstruction* cell_instruction = Add<HConstant>(cell); | 7953 HInstruction* site_instruction = Add<HConstant>(site); |
7951 | 7954 |
7952 // In the single constant argument case, we may have to adjust elements kind | 7955 // In the single constant argument case, we may have to adjust elements kind |
7953 // to avoid creating a packed non-empty array. | 7956 // to avoid creating a packed non-empty array. |
7954 if (argument_count == 1 && !IsHoleyElementsKind(kind)) { | 7957 if (argument_count == 1 && !IsHoleyElementsKind(kind)) { |
7955 HValue* argument = environment()->Top(); | 7958 HValue* argument = environment()->Top(); |
7956 if (argument->IsConstant()) { | 7959 if (argument->IsConstant()) { |
7957 HConstant* constant_argument = HConstant::cast(argument); | 7960 HConstant* constant_argument = HConstant::cast(argument); |
7958 ASSERT(constant_argument->HasSmiValue()); | 7961 ASSERT(constant_argument->HasSmiValue()); |
7959 int constant_array_size = constant_argument->Integer32Value(); | 7962 int constant_array_size = constant_argument->Integer32Value(); |
7960 if (constant_array_size != 0) { | 7963 if (constant_array_size != 0) { |
7961 kind = GetHoleyElementsKind(kind); | 7964 kind = GetHoleyElementsKind(kind); |
7962 } | 7965 } |
7963 } | 7966 } |
7964 } | 7967 } |
7965 | 7968 |
7966 // Build the array. | 7969 // Build the array. |
7967 JSArrayBuilder array_builder(this, | 7970 JSArrayBuilder array_builder(this, |
7968 kind, | 7971 kind, |
7969 cell_instruction, | 7972 site_instruction, |
7970 constructor, | 7973 constructor, |
7971 DISABLE_ALLOCATION_SITES); | 7974 DISABLE_ALLOCATION_SITES); |
7972 HValue* new_object; | 7975 HValue* new_object; |
7973 if (argument_count == 0) { | 7976 if (argument_count == 0) { |
7974 new_object = array_builder.AllocateEmptyArray(); | 7977 new_object = array_builder.AllocateEmptyArray(); |
7975 } else if (argument_count == 1) { | 7978 } else if (argument_count == 1) { |
7976 HValue* argument = environment()->Top(); | 7979 HValue* argument = environment()->Top(); |
7977 new_object = BuildAllocateArrayFromLength(&array_builder, argument); | 7980 new_object = BuildAllocateArrayFromLength(&array_builder, argument); |
7978 } else { | 7981 } else { |
7979 HValue* length = Add<HConstant>(argument_count); | 7982 HValue* length = Add<HConstant>(argument_count); |
(...skipping 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11003 if (ShouldProduceTraceOutput()) { | 11006 if (ShouldProduceTraceOutput()) { |
11004 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11007 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11005 } | 11008 } |
11006 | 11009 |
11007 #ifdef DEBUG | 11010 #ifdef DEBUG |
11008 graph_->Verify(false); // No full verify. | 11011 graph_->Verify(false); // No full verify. |
11009 #endif | 11012 #endif |
11010 } | 11013 } |
11011 | 11014 |
11012 } } // namespace v8::internal | 11015 } } // namespace v8::internal |
OLD | NEW |