| 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 | 2381 |
| 2382 HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( | 2382 HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
| 2383 HValue* checked_object, | 2383 HValue* checked_object, |
| 2384 HValue* key, | 2384 HValue* key, |
| 2385 HValue* val, | 2385 HValue* val, |
| 2386 bool is_js_array, | 2386 bool is_js_array, |
| 2387 ElementsKind elements_kind, | 2387 ElementsKind elements_kind, |
| 2388 PropertyAccessType access_type, | 2388 PropertyAccessType access_type, |
| 2389 LoadKeyedHoleMode load_mode, | 2389 LoadKeyedHoleMode load_mode, |
| 2390 KeyedAccessStoreMode store_mode) { | 2390 KeyedAccessStoreMode store_mode) { |
| 2391 DCHECK(top_info()->IsStub() || checked_object->IsCompareMap() || |
| 2392 checked_object->IsCheckMaps()); |
| 2391 DCHECK((!IsExternalArrayElementsKind(elements_kind) && | 2393 DCHECK((!IsExternalArrayElementsKind(elements_kind) && |
| 2392 !IsFixedTypedArrayElementsKind(elements_kind)) || | 2394 !IsFixedTypedArrayElementsKind(elements_kind)) || |
| 2393 !is_js_array); | 2395 !is_js_array); |
| 2394 // No GVNFlag is necessary for ElementsKind if there is an explicit dependency | 2396 // No GVNFlag is necessary for ElementsKind if there is an explicit dependency |
| 2395 // on a HElementsTransition instruction. The flag can also be removed if the | 2397 // on a HElementsTransition instruction. The flag can also be removed if the |
| 2396 // map to check has FAST_HOLEY_ELEMENTS, since there can be no further | 2398 // map to check has FAST_HOLEY_ELEMENTS, since there can be no further |
| 2397 // ElementsKind transitions. Finally, the dependency can be removed for stores | 2399 // ElementsKind transitions. Finally, the dependency can be removed for stores |
| 2398 // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the | 2400 // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the |
| 2399 // generated store code. | 2401 // generated store code. |
| 2400 if ((elements_kind == FAST_HOLEY_ELEMENTS) || | 2402 if ((elements_kind == FAST_HOLEY_ELEMENTS) || |
| (...skipping 6015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8416 | 8418 |
| 8417 { | 8419 { |
| 8418 NoObservableSideEffectsScope scope(this); | 8420 NoObservableSideEffectsScope scope(this); |
| 8419 | 8421 |
| 8420 length = Add<HLoadNamedField>( | 8422 length = Add<HLoadNamedField>( |
| 8421 array, nullptr, HObjectAccess::ForArrayLength(elements_kind)); | 8423 array, nullptr, HObjectAccess::ForArrayLength(elements_kind)); |
| 8422 | 8424 |
| 8423 new_size = AddUncasted<HAdd>(length, graph()->GetConstant1()); | 8425 new_size = AddUncasted<HAdd>(length, graph()->GetConstant1()); |
| 8424 | 8426 |
| 8425 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 8427 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 8426 BuildUncheckedMonomorphicElementAccess(array, length, | 8428 HValue* checked_array = Add<HCheckMaps>(array, receiver_map); |
| 8427 value_to_push, is_array, | 8429 BuildUncheckedMonomorphicElementAccess( |
| 8428 elements_kind, STORE, | 8430 checked_array, length, value_to_push, is_array, elements_kind, |
| 8429 NEVER_RETURN_HOLE, | 8431 STORE, NEVER_RETURN_HOLE, STORE_AND_GROW_NO_TRANSITION); |
| 8430 STORE_AND_GROW_NO_TRANSITION); | |
| 8431 | 8432 |
| 8432 if (!ast_context()->IsEffect()) Push(new_size); | 8433 if (!ast_context()->IsEffect()) Push(new_size); |
| 8433 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 8434 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
| 8434 if (!ast_context()->IsEffect()) Drop(1); | 8435 if (!ast_context()->IsEffect()) Drop(1); |
| 8435 } | 8436 } |
| 8436 | 8437 |
| 8437 ast_context()->ReturnValue(new_size); | 8438 ast_context()->ReturnValue(new_size); |
| 8438 return true; | 8439 return true; |
| 8439 } | 8440 } |
| 8440 case kArrayShift: { | 8441 case kArrayShift: { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8787 return true; | 8788 return true; |
| 8788 } | 8789 } |
| 8789 | 8790 |
| 8790 | 8791 |
| 8791 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, | 8792 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, |
| 8792 int arguments_count) { | 8793 int arguments_count) { |
| 8793 Handle<JSFunction> known_function; | 8794 Handle<JSFunction> known_function; |
| 8794 int args_count_no_receiver = arguments_count - 1; | 8795 int args_count_no_receiver = arguments_count - 1; |
| 8795 if (function->IsConstant() && | 8796 if (function->IsConstant() && |
| 8796 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { | 8797 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { |
| 8797 HValue* receiver = environment()->ExpressionStackAt(args_count_no_receiver); | |
| 8798 Handle<Map> receiver_map; | |
| 8799 if (receiver->IsConstant() && | |
| 8800 HConstant::cast(receiver)->handle(isolate())->IsHeapObject()) { | |
| 8801 receiver_map = | |
| 8802 handle(Handle<HeapObject>::cast( | |
| 8803 HConstant::cast(receiver)->handle(isolate()))->map()); | |
| 8804 } | |
| 8805 | |
| 8806 known_function = | 8798 known_function = |
| 8807 Handle<JSFunction>::cast(HConstant::cast(function)->handle(isolate())); | 8799 Handle<JSFunction>::cast(HConstant::cast(function)->handle(isolate())); |
| 8808 if (TryInlineBuiltinMethodCall(expr, known_function, receiver_map, | 8800 if (TryInlineBuiltinMethodCall(expr, known_function, Handle<Map>(), |
| 8809 args_count_no_receiver)) { | 8801 args_count_no_receiver)) { |
| 8810 if (FLAG_trace_inlining) { | 8802 if (FLAG_trace_inlining) { |
| 8811 PrintF("Inlining builtin "); | 8803 PrintF("Inlining builtin "); |
| 8812 known_function->ShortPrint(); | 8804 known_function->ShortPrint(); |
| 8813 PrintF("\n"); | 8805 PrintF("\n"); |
| 8814 } | 8806 } |
| 8815 return; | 8807 return; |
| 8816 } | 8808 } |
| 8817 | 8809 |
| 8818 if (TryInlineIndirectCall(known_function, expr, args_count_no_receiver)) { | 8810 if (TryInlineIndirectCall(known_function, expr, args_count_no_receiver)) { |
| (...skipping 4591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13410 if (ShouldProduceTraceOutput()) { | 13402 if (ShouldProduceTraceOutput()) { |
| 13411 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13403 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13412 } | 13404 } |
| 13413 | 13405 |
| 13414 #ifdef DEBUG | 13406 #ifdef DEBUG |
| 13415 graph_->Verify(false); // No full verify. | 13407 graph_->Verify(false); // No full verify. |
| 13416 #endif | 13408 #endif |
| 13417 } | 13409 } |
| 13418 | 13410 |
| 13419 } } // namespace v8::internal | 13411 } } // namespace v8::internal |
| OLD | NEW |