| 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 6162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()) { |
| 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 ElementsKind boilerplate_elements_kind = expr->constant_elements_kind(); | |
| 6184 if (!boilerplate_object.is_null()) { | |
| 6185 boilerplate_elements_kind = boilerplate_object->GetElementsKind(); | |
| 6186 } | |
| 6187 | |
| 6188 // Check whether to use fast or slow deep-copying for boilerplate. | 6183 // Check whether to use fast or slow deep-copying for boilerplate. |
| 6189 int max_properties = kMaxFastLiteralProperties; | 6184 int max_properties = kMaxFastLiteralProperties; |
| 6190 if (!boilerplate_object.is_null() && | 6185 if (!boilerplate_object.is_null() && |
| 6191 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, | 6186 IsFastLiteral(boilerplate_object, kMaxFastLiteralDepth, |
| 6192 &max_properties)) { | 6187 &max_properties)) { |
| 6193 DCHECK(site->SitePointsToLiteral()); | 6188 DCHECK(site->SitePointsToLiteral()); |
| 6194 AllocationSiteUsageContext site_context(isolate(), site, false); | 6189 AllocationSiteUsageContext site_context(isolate(), site, false); |
| 6195 site_context.EnterNewScope(); | 6190 site_context.EnterNewScope(); |
| 6196 literal = BuildFastLiteral(boilerplate_object, &site_context); | 6191 literal = BuildFastLiteral(boilerplate_object, &site_context); |
| 6197 site_context.ExitScope(site, boilerplate_object); | 6192 site_context.ExitScope(site, boilerplate_object); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6228 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 6223 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 6229 | 6224 |
| 6230 CHECK_ALIVE(VisitForValue(subexpr)); | 6225 CHECK_ALIVE(VisitForValue(subexpr)); |
| 6231 HValue* value = Pop(); | 6226 HValue* value = Pop(); |
| 6232 if (!Smi::IsValid(i)) return Bailout(kNonSmiKeyInArrayLiteral); | 6227 if (!Smi::IsValid(i)) return Bailout(kNonSmiKeyInArrayLiteral); |
| 6233 | 6228 |
| 6234 elements = AddLoadElements(literal); | 6229 elements = AddLoadElements(literal); |
| 6235 | 6230 |
| 6236 HValue* key = Add<HConstant>(i); | 6231 HValue* key = Add<HConstant>(i); |
| 6237 | 6232 |
| 6238 switch (boilerplate_elements_kind) { | 6233 if (!boilerplate_object.is_null()) { |
| 6239 case FAST_SMI_ELEMENTS: | 6234 ElementsKind boilerplate_elements_kind = |
| 6240 case FAST_HOLEY_SMI_ELEMENTS: | 6235 boilerplate_object->GetElementsKind(); |
| 6241 case FAST_ELEMENTS: | 6236 switch (boilerplate_elements_kind) { |
| 6242 case FAST_HOLEY_ELEMENTS: | 6237 case FAST_SMI_ELEMENTS: |
| 6243 case FAST_DOUBLE_ELEMENTS: | 6238 case FAST_HOLEY_SMI_ELEMENTS: |
| 6244 case FAST_HOLEY_DOUBLE_ELEMENTS: { | 6239 case FAST_ELEMENTS: |
| 6245 Add<HStoreKeyed>(elements, key, value, nullptr, | 6240 case FAST_HOLEY_ELEMENTS: |
| 6246 boilerplate_elements_kind); | 6241 case FAST_DOUBLE_ELEMENTS: |
| 6247 break; | 6242 case FAST_HOLEY_DOUBLE_ELEMENTS: { |
| 6243 Add<HStoreKeyed>(elements, key, value, nullptr, |
| 6244 boilerplate_elements_kind); |
| 6245 break; |
| 6246 } |
| 6247 default: |
| 6248 UNREACHABLE(); |
| 6249 break; |
| 6248 } | 6250 } |
| 6249 default: | 6251 } else { |
| 6250 UNREACHABLE(); | 6252 HInstruction* instr = BuildKeyedGeneric( |
| 6251 break; | 6253 STORE, expr, expr->LiteralFeedbackSlot(), literal, key, value); |
| 6254 AddInstruction(instr); |
| 6252 } | 6255 } |
| 6253 | 6256 |
| 6254 Add<HSimulate>(expr->GetIdForElement(i)); | 6257 Add<HSimulate>(expr->GetIdForElement(i)); |
| 6255 } | 6258 } |
| 6256 | 6259 |
| 6257 return ast_context()->ReturnValue(Pop()); | 6260 return ast_context()->ReturnValue(Pop()); |
| 6258 } | 6261 } |
| 6259 | 6262 |
| 6260 | 6263 |
| 6261 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, | 6264 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, |
| (...skipping 7446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13708 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13711 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13709 } | 13712 } |
| 13710 | 13713 |
| 13711 #ifdef DEBUG | 13714 #ifdef DEBUG |
| 13712 graph_->Verify(false); // No full verify. | 13715 graph_->Verify(false); // No full verify. |
| 13713 #endif | 13716 #endif |
| 13714 } | 13717 } |
| 13715 | 13718 |
| 13716 } // namespace internal | 13719 } // namespace internal |
| 13717 } // namespace v8 | 13720 } // namespace v8 |
| OLD | NEW |