Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/hydrogen.cc

Issue 1087463003: Fix indirect push (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-indirect-push-unchecked.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after
8440 8442
8441 { 8443 {
8442 NoObservableSideEffectsScope scope(this); 8444 NoObservableSideEffectsScope scope(this);
8443 8445
8444 length = Add<HLoadNamedField>( 8446 length = Add<HLoadNamedField>(
8445 array, nullptr, HObjectAccess::ForArrayLength(elements_kind)); 8447 array, nullptr, HObjectAccess::ForArrayLength(elements_kind));
8446 8448
8447 new_size = AddUncasted<HAdd>(length, graph()->GetConstant1()); 8449 new_size = AddUncasted<HAdd>(length, graph()->GetConstant1());
8448 8450
8449 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 8451 bool is_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
8450 BuildUncheckedMonomorphicElementAccess(array, length, 8452 HValue* checked_array = Add<HCheckMaps>(array, receiver_map);
8451 value_to_push, is_array, 8453 BuildUncheckedMonomorphicElementAccess(
8452 elements_kind, STORE, 8454 checked_array, length, value_to_push, is_array, elements_kind,
8453 NEVER_RETURN_HOLE, 8455 STORE, NEVER_RETURN_HOLE, STORE_AND_GROW_NO_TRANSITION);
8454 STORE_AND_GROW_NO_TRANSITION);
8455 8456
8456 if (!ast_context()->IsEffect()) Push(new_size); 8457 if (!ast_context()->IsEffect()) Push(new_size);
8457 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); 8458 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
8458 if (!ast_context()->IsEffect()) Drop(1); 8459 if (!ast_context()->IsEffect()) Drop(1);
8459 } 8460 }
8460 8461
8461 ast_context()->ReturnValue(new_size); 8462 ast_context()->ReturnValue(new_size);
8462 return true; 8463 return true;
8463 } 8464 }
8464 case kArrayShift: { 8465 case kArrayShift: {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
8811 return true; 8812 return true;
8812 } 8813 }
8813 8814
8814 8815
8815 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, 8816 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function,
8816 int arguments_count) { 8817 int arguments_count) {
8817 Handle<JSFunction> known_function; 8818 Handle<JSFunction> known_function;
8818 int args_count_no_receiver = arguments_count - 1; 8819 int args_count_no_receiver = arguments_count - 1;
8819 if (function->IsConstant() && 8820 if (function->IsConstant() &&
8820 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { 8821 HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
8821 HValue* receiver = environment()->ExpressionStackAt(args_count_no_receiver);
8822 Handle<Map> receiver_map;
8823 if (receiver->IsConstant() &&
8824 HConstant::cast(receiver)->handle(isolate())->IsHeapObject()) {
8825 receiver_map =
8826 handle(Handle<HeapObject>::cast(
8827 HConstant::cast(receiver)->handle(isolate()))->map());
8828 }
8829
8830 known_function = 8822 known_function =
8831 Handle<JSFunction>::cast(HConstant::cast(function)->handle(isolate())); 8823 Handle<JSFunction>::cast(HConstant::cast(function)->handle(isolate()));
8832 if (TryInlineBuiltinMethodCall(expr, known_function, receiver_map, 8824 if (TryInlineBuiltinMethodCall(expr, known_function, Handle<Map>(),
8833 args_count_no_receiver)) { 8825 args_count_no_receiver)) {
8834 if (FLAG_trace_inlining) { 8826 if (FLAG_trace_inlining) {
8835 PrintF("Inlining builtin "); 8827 PrintF("Inlining builtin ");
8836 known_function->ShortPrint(); 8828 known_function->ShortPrint();
8837 PrintF("\n"); 8829 PrintF("\n");
8838 } 8830 }
8839 return; 8831 return;
8840 } 8832 }
8841 8833
8842 if (TryInlineIndirectCall(known_function, expr, args_count_no_receiver)) { 8834 if (TryInlineIndirectCall(known_function, expr, args_count_no_receiver)) {
(...skipping 4110 matching lines...) Expand 10 before | Expand all | Expand 10 after
12953 if (ShouldProduceTraceOutput()) { 12945 if (ShouldProduceTraceOutput()) {
12954 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12946 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12955 } 12947 }
12956 12948
12957 #ifdef DEBUG 12949 #ifdef DEBUG
12958 graph_->Verify(false); // No full verify. 12950 graph_->Verify(false); // No full verify.
12959 #endif 12951 #endif
12960 } 12952 }
12961 12953
12962 } } // namespace v8::internal 12954 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-indirect-push-unchecked.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698