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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 132623005: A64: Synchronize with r18642. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/builtins-ia32.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 namespace internal { 49 namespace internal {
50 50
51 #define DEFINE_COMPILE(type) \ 51 #define DEFINE_COMPILE(type) \
52 LInstruction* H##type::CompileToLithium(LChunkBuilder* builder) { \ 52 LInstruction* H##type::CompileToLithium(LChunkBuilder* builder) { \
53 return builder->Do##type(this); \ 53 return builder->Do##type(this); \
54 } 54 }
55 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) 55 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
56 #undef DEFINE_COMPILE 56 #undef DEFINE_COMPILE
57 57
58 58
59 int HValue::LoopWeight() const {
60 const int w = FLAG_loop_weight;
61 static const int weights[] = { 1, w, w*w, w*w*w, w*w*w*w };
62 return weights[Min(block()->LoopNestingDepth(),
63 static_cast<int>(ARRAY_SIZE(weights)-1))];
64 }
65
66
67 Isolate* HValue::isolate() const { 59 Isolate* HValue::isolate() const {
68 ASSERT(block() != NULL); 60 ASSERT(block() != NULL);
69 return block()->isolate(); 61 return block()->isolate();
70 } 62 }
71 63
72 64
73 void HValue::AssumeRepresentation(Representation r) { 65 void HValue::AssumeRepresentation(Representation r) {
74 if (CheckFlag(kFlexibleRepresentation)) { 66 if (CheckFlag(kFlexibleRepresentation)) {
75 ChangeRepresentation(r); 67 ChangeRepresentation(r);
76 // The representation of the value is dictated by type feedback and 68 // The representation of the value is dictated by type feedback and
(...skipping 24 matching lines...) Expand all
101 93
102 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 94 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
103 HValue* use = it.value(); 95 HValue* use = it.value();
104 Representation rep = use->observed_input_representation(it.index()); 96 Representation rep = use->observed_input_representation(it.index());
105 if (rep.IsNone()) continue; 97 if (rep.IsNone()) continue;
106 if (FLAG_trace_representation) { 98 if (FLAG_trace_representation) {
107 PrintF("#%d %s is used by #%d %s as %s%s\n", 99 PrintF("#%d %s is used by #%d %s as %s%s\n",
108 id(), Mnemonic(), use->id(), use->Mnemonic(), rep.Mnemonic(), 100 id(), Mnemonic(), use->id(), use->Mnemonic(), rep.Mnemonic(),
109 (use->CheckFlag(kTruncatingToInt32) ? "-trunc" : "")); 101 (use->CheckFlag(kTruncatingToInt32) ? "-trunc" : ""));
110 } 102 }
111 use_count[rep.kind()] += use->LoopWeight(); 103 use_count[rep.kind()] += 1;
112 } 104 }
113 if (IsPhi()) HPhi::cast(this)->AddIndirectUsesTo(&use_count[0]); 105 if (IsPhi()) HPhi::cast(this)->AddIndirectUsesTo(&use_count[0]);
114 int tagged_count = use_count[Representation::kTagged]; 106 int tagged_count = use_count[Representation::kTagged];
115 int double_count = use_count[Representation::kDouble]; 107 int double_count = use_count[Representation::kDouble];
116 int int32_count = use_count[Representation::kInteger32]; 108 int int32_count = use_count[Representation::kInteger32];
117 int smi_count = use_count[Representation::kSmi]; 109 int smi_count = use_count[Representation::kSmi];
118 110
119 if (tagged_count > 0) return Representation::Tagged(); 111 if (tagged_count > 0) return Representation::Tagged();
120 if (double_count > 0) return Representation::Double(); 112 if (double_count > 0) return Representation::Double();
121 if (int32_count > 0) return Representation::Integer32(); 113 if (int32_count > 0) return Representation::Integer32();
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 } 836 }
845 837
846 838
847 void HUnaryCall::PrintDataTo(StringStream* stream) { 839 void HUnaryCall::PrintDataTo(StringStream* stream) {
848 value()->PrintNameTo(stream); 840 value()->PrintNameTo(stream);
849 stream->Add(" "); 841 stream->Add(" ");
850 stream->Add("#%d", argument_count()); 842 stream->Add("#%d", argument_count());
851 } 843 }
852 844
853 845
846 void HCallJSFunction::PrintDataTo(StringStream* stream) {
847 OperandAt(0)->PrintNameTo(stream);
848 stream->Add(" ");
849 OperandAt(1)->PrintNameTo(stream);
850 stream->Add(" ");
851 stream->Add("#%d", argument_count());
852 }
853
854
855 HCallJSFunction* HCallJSFunction::New(
856 Zone* zone,
857 HValue* context,
858 HValue* function,
859 int argument_count,
860 bool pass_argument_count) {
861 bool has_stack_check = false;
862 if (function->IsConstant()) {
863 HConstant* fun_const = HConstant::cast(function);
864 Handle<JSFunction> jsfun =
865 Handle<JSFunction>::cast(fun_const->handle(zone->isolate()));
866 has_stack_check = !jsfun.is_null() &&
867 (jsfun->code()->kind() == Code::FUNCTION ||
868 jsfun->code()->kind() == Code::OPTIMIZED_FUNCTION);
869 }
870
871 return new(zone) HCallJSFunction(
872 function, argument_count, pass_argument_count,
873 has_stack_check);
874 }
875
876
877
878
854 void HBinaryCall::PrintDataTo(StringStream* stream) { 879 void HBinaryCall::PrintDataTo(StringStream* stream) {
855 first()->PrintNameTo(stream); 880 first()->PrintNameTo(stream);
856 stream->Add(" "); 881 stream->Add(" ");
857 second()->PrintNameTo(stream); 882 second()->PrintNameTo(stream);
858 stream->Add(" "); 883 stream->Add(" ");
859 stream->Add("#%d", argument_count()); 884 stream->Add("#%d", argument_count());
860 } 885 }
861 886
862 887
863 void HBoundsCheck::ApplyIndexChange() { 888 void HBoundsCheck::ApplyIndexChange() {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 994
970 995
971 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) { 996 void HBoundsCheckBaseIndexInformation::PrintDataTo(StringStream* stream) {
972 stream->Add("base: "); 997 stream->Add("base: ");
973 base_index()->PrintNameTo(stream); 998 base_index()->PrintNameTo(stream);
974 stream->Add(", check: "); 999 stream->Add(", check: ");
975 base_index()->PrintNameTo(stream); 1000 base_index()->PrintNameTo(stream);
976 } 1001 }
977 1002
978 1003
979 void HCallConstantFunction::PrintDataTo(StringStream* stream) { 1004 void HCallWithDescriptor::PrintDataTo(StringStream* stream) {
980 if (IsApplyFunction()) { 1005 for (int i = 0; i < OperandCount(); i++) {
981 stream->Add("optimized apply "); 1006 OperandAt(i)->PrintNameTo(stream);
982 } else { 1007 stream->Add(" ");
983 stream->Add("%o ", function()->shared()->DebugName());
984 } 1008 }
985 stream->Add("#%d", argument_count()); 1009 stream->Add("#%d", argument_count());
986 } 1010 }
987 1011
988 1012
989 void HCallNamed::PrintDataTo(StringStream* stream) {
990 stream->Add("%o ", *name());
991 HUnaryCall::PrintDataTo(stream);
992 }
993
994
995 void HCallGlobal::PrintDataTo(StringStream* stream) {
996 stream->Add("%o ", *name());
997 HUnaryCall::PrintDataTo(stream);
998 }
999
1000
1001 void HCallKnownGlobal::PrintDataTo(StringStream* stream) {
1002 stream->Add("%o ", target()->shared()->DebugName());
1003 stream->Add("#%d", argument_count());
1004 }
1005
1006
1007 void HCallNewArray::PrintDataTo(StringStream* stream) { 1013 void HCallNewArray::PrintDataTo(StringStream* stream) {
1008 stream->Add(ElementsKindToString(elements_kind())); 1014 stream->Add(ElementsKindToString(elements_kind()));
1009 stream->Add(" "); 1015 stream->Add(" ");
1010 HBinaryCall::PrintDataTo(stream); 1016 HBinaryCall::PrintDataTo(stream);
1011 } 1017 }
1012 1018
1013 1019
1014 void HCallRuntime::PrintDataTo(StringStream* stream) { 1020 void HCallRuntime::PrintDataTo(StringStream* stream) {
1015 stream->Add("%o ", *name()); 1021 stream->Add("%o ", *name());
1016 if (save_doubles() == kSaveFPRegs) { 1022 if (save_doubles() == kSaveFPRegs) {
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 phi_id_ = phi_id; 2358 phi_id_ = phi_id;
2353 // Compute a conservative approximation of truncating uses before inferring 2359 // Compute a conservative approximation of truncating uses before inferring
2354 // representations. The proper, exact computation will be done later, when 2360 // representations. The proper, exact computation will be done later, when
2355 // inserting representation changes. 2361 // inserting representation changes.
2356 SetFlag(kTruncatingToSmi); 2362 SetFlag(kTruncatingToSmi);
2357 SetFlag(kTruncatingToInt32); 2363 SetFlag(kTruncatingToInt32);
2358 for (HUseIterator it(uses()); !it.Done(); it.Advance()) { 2364 for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
2359 HValue* value = it.value(); 2365 HValue* value = it.value();
2360 if (!value->IsPhi()) { 2366 if (!value->IsPhi()) {
2361 Representation rep = value->observed_input_representation(it.index()); 2367 Representation rep = value->observed_input_representation(it.index());
2362 non_phi_uses_[rep.kind()] += value->LoopWeight(); 2368 non_phi_uses_[rep.kind()] += 1;
2363 if (FLAG_trace_representation) { 2369 if (FLAG_trace_representation) {
2364 PrintF("#%d Phi is used by real #%d %s as %s\n", 2370 PrintF("#%d Phi is used by real #%d %s as %s\n",
2365 id(), value->id(), value->Mnemonic(), rep.Mnemonic()); 2371 id(), value->id(), value->Mnemonic(), rep.Mnemonic());
2366 } 2372 }
2367 if (!value->IsSimulate()) { 2373 if (!value->IsSimulate()) {
2368 if (!value->CheckFlag(kTruncatingToSmi)) { 2374 if (!value->CheckFlag(kTruncatingToSmi)) {
2369 ClearFlag(kTruncatingToSmi); 2375 ClearFlag(kTruncatingToSmi);
2370 } 2376 }
2371 if (!value->CheckFlag(kTruncatingToInt32)) { 2377 if (!value->CheckFlag(kTruncatingToInt32)) {
2372 ClearFlag(kTruncatingToInt32); 2378 ClearFlag(kTruncatingToInt32);
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after
4447 break; 4453 break;
4448 case kExternalMemory: 4454 case kExternalMemory:
4449 stream->Add("[external-memory]"); 4455 stream->Add("[external-memory]");
4450 break; 4456 break;
4451 } 4457 }
4452 4458
4453 stream->Add("@%d", offset()); 4459 stream->Add("@%d", offset());
4454 } 4460 }
4455 4461
4456 } } // namespace v8::internal 4462 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698