| 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 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2384 | 2384 |
| 2385 HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( | 2385 HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
| 2386 HValue* checked_object, | 2386 HValue* checked_object, |
| 2387 HValue* key, | 2387 HValue* key, |
| 2388 HValue* val, | 2388 HValue* val, |
| 2389 bool is_js_array, | 2389 bool is_js_array, |
| 2390 ElementsKind elements_kind, | 2390 ElementsKind elements_kind, |
| 2391 PropertyAccessType access_type, | 2391 PropertyAccessType access_type, |
| 2392 LoadKeyedHoleMode load_mode, | 2392 LoadKeyedHoleMode load_mode, |
| 2393 KeyedAccessStoreMode store_mode) { | 2393 KeyedAccessStoreMode store_mode) { |
| 2394 DCHECK(top_info()->IsStub() || checked_object->IsCompareMap() || |
| 2395 checked_object->IsCheckMaps()); |
| 2394 DCHECK((!IsExternalArrayElementsKind(elements_kind) && | 2396 DCHECK((!IsExternalArrayElementsKind(elements_kind) && |
| 2395 !IsFixedTypedArrayElementsKind(elements_kind)) || | 2397 !IsFixedTypedArrayElementsKind(elements_kind)) || |
| 2396 !is_js_array); | 2398 !is_js_array); |
| 2397 // No GVNFlag is necessary for ElementsKind if there is an explicit dependency | 2399 // No GVNFlag is necessary for ElementsKind if there is an explicit dependency |
| 2398 // on a HElementsTransition instruction. The flag can also be removed if the | 2400 // on a HElementsTransition instruction. The flag can also be removed if the |
| 2399 // map to check has FAST_HOLEY_ELEMENTS, since there can be no further | 2401 // map to check has FAST_HOLEY_ELEMENTS, since there can be no further |
| 2400 // ElementsKind transitions. Finally, the dependency can be removed for stores | 2402 // ElementsKind transitions. Finally, the dependency can be removed for stores |
| 2401 // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the | 2403 // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the |
| 2402 // generated store code. | 2404 // generated store code. |
| 2403 if ((elements_kind == FAST_HOLEY_ELEMENTS) || | 2405 if ((elements_kind == FAST_HOLEY_ELEMENTS) || |
| (...skipping 5990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8394 | 8396 |
| 8395 { | 8397 { |
| 8396 NoObservableSideEffectsScope scope(this); | 8398 NoObservableSideEffectsScope scope(this); |
| 8397 | 8399 |
| 8398 length = Add<HLoadNamedField>( | 8400 length = Add<HLoadNamedField>( |
| 8399 array, nullptr, HObjectAccess::ForArrayLength(elements_kind)); | 8401 array, nullptr, HObjectAccess::ForArrayLength(elements_kind)); |
| 8400 | 8402 |
| 8401 new_size = AddUncasted<HAdd>(length, graph()->GetConstant1()); | 8403 new_size = AddUncasted<HAdd>(length, graph()->GetConstant1()); |
| 8402 | 8404 |
| 8403 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE; | 8405 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 8404 BuildUncheckedMonomorphicElementAccess(array, length, | 8406 HValue* checked_array = Add<HCheckMaps>(array, receiver_map); |
| 8405 value_to_push, is_array, | 8407 BuildUncheckedMonomorphicElementAccess( |
| 8406 elements_kind, STORE, | 8408 checked_array, length, value_to_push, is_array, elements_kind, |
| 8407 NEVER_RETURN_HOLE, | 8409 STORE, NEVER_RETURN_HOLE, STORE_AND_GROW_NO_TRANSITION); |
| 8408 STORE_AND_GROW_NO_TRANSITION); | |
| 8409 | 8410 |
| 8410 if (!ast_context()->IsEffect()) Push(new_size); | 8411 if (!ast_context()->IsEffect()) Push(new_size); |
| 8411 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 8412 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
| 8412 if (!ast_context()->IsEffect()) Drop(1); | 8413 if (!ast_context()->IsEffect()) Drop(1); |
| 8413 } | 8414 } |
| 8414 | 8415 |
| 8415 ast_context()->ReturnValue(new_size); | 8416 ast_context()->ReturnValue(new_size); |
| 8416 return true; | 8417 return true; |
| 8417 } | 8418 } |
| 8418 case kArrayShift: { | 8419 case kArrayShift: { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8756 return true; | 8757 return true; |
| 8757 } | 8758 } |
| 8758 | 8759 |
| 8759 | 8760 |
| 8760 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, | 8761 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, |
| 8761 int arguments_count) { | 8762 int arguments_count) { |
| 8762 Handle<JSFunction> known_function; | 8763 Handle<JSFunction> known_function; |
| 8763 int args_count_no_receiver = arguments_count - 1; | 8764 int args_count_no_receiver = arguments_count - 1; |
| 8764 if (function->IsConstant() && | 8765 if (function->IsConstant() && |
| 8765 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { | 8766 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { |
| 8766 HValue* receiver = environment()->ExpressionStackAt(args_count_no_receiver); | |
| 8767 Handle<Map> receiver_map; | |
| 8768 if (receiver->IsConstant() && | |
| 8769 HConstant::cast(receiver)->handle(isolate())->IsHeapObject()) { | |
| 8770 receiver_map = | |
| 8771 handle(Handle<HeapObject>::cast( | |
| 8772 HConstant::cast(receiver)->handle(isolate()))->map()); | |
| 8773 } | |
| 8774 | |
| 8775 known_function = | 8767 known_function = |
| 8776 Handle<JSFunction>::cast(HConstant::cast(function)->handle(isolate())); | 8768 Handle<JSFunction>::cast(HConstant::cast(function)->handle(isolate())); |
| 8777 if (TryInlineBuiltinMethodCall(expr, known_function, receiver_map, | 8769 if (TryInlineBuiltinMethodCall(expr, known_function, Handle<Map>(), |
| 8778 args_count_no_receiver)) { | 8770 args_count_no_receiver)) { |
| 8779 if (FLAG_trace_inlining) { | 8771 if (FLAG_trace_inlining) { |
| 8780 PrintF("Inlining builtin "); | 8772 PrintF("Inlining builtin "); |
| 8781 known_function->ShortPrint(); | 8773 known_function->ShortPrint(); |
| 8782 PrintF("\n"); | 8774 PrintF("\n"); |
| 8783 } | 8775 } |
| 8784 return; | 8776 return; |
| 8785 } | 8777 } |
| 8786 | 8778 |
| 8787 if (TryInlineIndirectCall(known_function, expr, args_count_no_receiver)) { | 8779 if (TryInlineIndirectCall(known_function, expr, args_count_no_receiver)) { |
| (...skipping 4643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13431 if (ShouldProduceTraceOutput()) { | 13423 if (ShouldProduceTraceOutput()) { |
| 13432 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13424 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13433 } | 13425 } |
| 13434 | 13426 |
| 13435 #ifdef DEBUG | 13427 #ifdef DEBUG |
| 13436 graph_->Verify(false); // No full verify. | 13428 graph_->Verify(false); // No full verify. |
| 13437 #endif | 13429 #endif |
| 13438 } | 13430 } |
| 13439 | 13431 |
| 13440 } } // namespace v8::internal | 13432 } } // namespace v8::internal |
| OLD | NEW |