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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 22339018: Deoptimization is easier to diagnose when there is a text reason. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 4 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.h » ('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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 public: 85 public:
86 ArrayContextChecker(HGraphBuilder* builder, HValue* constructor, 86 ArrayContextChecker(HGraphBuilder* builder, HValue* constructor,
87 HValue* array_function) 87 HValue* array_function)
88 : checker_(builder) { 88 : checker_(builder) {
89 checker_.If<HCompareObjectEqAndBranch, HValue*>(constructor, 89 checker_.If<HCompareObjectEqAndBranch, HValue*>(constructor,
90 array_function); 90 array_function);
91 checker_.Then(); 91 checker_.Then();
92 } 92 }
93 93
94 ~ArrayContextChecker() { 94 ~ArrayContextChecker() {
95 checker_.ElseDeopt(); 95 checker_.ElseDeopt("Array constructor called from different context");
96 checker_.End(); 96 checker_.End();
97 } 97 }
98 private: 98 private:
99 IfBuilder checker_; 99 IfBuilder checker_;
100 }; 100 };
101 101
102 enum ArgumentClass { 102 enum ArgumentClass {
103 NONE, 103 NONE,
104 SINGLE, 104 SINGLE,
105 MULTIPLE 105 MULTIPLE
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 UNIMPLEMENTED(); 226 UNIMPLEMENTED();
227 return NULL; 227 return NULL;
228 } 228 }
229 229
230 virtual HValue* BuildCodeUninitializedStub() { 230 virtual HValue* BuildCodeUninitializedStub() {
231 // Force a deopt that falls back to the runtime. 231 // Force a deopt that falls back to the runtime.
232 HValue* undefined = graph()->GetConstantUndefined(); 232 HValue* undefined = graph()->GetConstantUndefined();
233 IfBuilder builder(this); 233 IfBuilder builder(this);
234 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined); 234 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined);
235 builder.Then(); 235 builder.Then();
236 builder.ElseDeopt(); 236 builder.ElseDeopt("Forced deopt to runtime");
237 return undefined; 237 return undefined;
238 } 238 }
239 239
240 Stub* casted_stub() { return static_cast<Stub*>(stub()); } 240 Stub* casted_stub() { return static_cast<Stub*>(stub()); }
241 }; 241 };
242 242
243 243
244 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) { 244 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) {
245 Factory* factory = isolate->factory(); 245 Factory* factory = isolate->factory();
246 246
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 length)); 380 length));
381 } else { 381 } else {
382 ElementsKind elements_kind = casted_stub()->ComputeElementsKind(); 382 ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
383 environment()->Push(BuildCloneShallowArray(boilerplate, 383 environment()->Push(BuildCloneShallowArray(boilerplate,
384 allocation_site, 384 allocation_site,
385 alloc_site_mode, 385 alloc_site_mode,
386 elements_kind, 386 elements_kind,
387 length)); 387 length));
388 } 388 }
389 389
390 checker.ElseDeopt(); 390 checker.ElseDeopt("Uninitialized boilerplate literals");
391 checker.End(); 391 checker.End();
392 392
393 return environment()->Pop(); 393 return environment()->Pop();
394 } 394 }
395 395
396 396
397 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { 397 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
398 return DoGenerateCode(this); 398 return DoGenerateCode(this);
399 } 399 }
400 400
(...skipping 26 matching lines...) Expand all
427 HInstruction* object = Add<HAllocate>(size_in_bytes, HType::JSObject(), 427 HInstruction* object = Add<HAllocate>(size_in_bytes, HType::JSObject(),
428 isolate()->heap()->GetPretenureMode(), JS_OBJECT_TYPE); 428 isolate()->heap()->GetPretenureMode(), JS_OBJECT_TYPE);
429 429
430 for (int i = 0; i < size; i += kPointerSize) { 430 for (int i = 0; i < size; i += kPointerSize) {
431 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); 431 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i);
432 Add<HStoreNamedField>(object, access, 432 Add<HStoreNamedField>(object, access,
433 Add<HLoadNamedField>(boilerplate, access)); 433 Add<HLoadNamedField>(boilerplate, access));
434 } 434 }
435 435
436 environment()->Push(object); 436 environment()->Push(object);
437 checker.ElseDeopt(); 437 checker.ElseDeopt("Uninitialized boilerplate in fast clone");
438 checker.End(); 438 checker.End();
439 439
440 return environment()->Pop(); 440 return environment()->Pop();
441 } 441 }
442 442
443 443
444 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { 444 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
445 return DoGenerateCode(this); 445 return DoGenerateCode(this);
446 } 446 }
447 447
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 Add<HCheckMaps>(receiver, placeholder_map, top_info()); 837 Add<HCheckMaps>(receiver, placeholder_map, top_info());
838 838
839 HValue* cell = Add<HConstant>(placeholder_cell); 839 HValue* cell = Add<HConstant>(placeholder_cell);
840 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); 840 HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
841 HValue* cell_contents = Add<HLoadNamedField>(cell, access); 841 HValue* cell_contents = Add<HLoadNamedField>(cell, access);
842 842
843 if (stub->is_constant()) { 843 if (stub->is_constant()) {
844 IfBuilder builder(this); 844 IfBuilder builder(this);
845 builder.If<HCompareObjectEqAndBranch>(cell_contents, value); 845 builder.If<HCompareObjectEqAndBranch>(cell_contents, value);
846 builder.Then(); 846 builder.Then();
847 builder.ElseDeopt(); 847 builder.ElseDeopt("Unexpected cell contents in constant global store");
848 builder.End(); 848 builder.End();
849 } else { 849 } else {
850 // Load the payload of the global parameter cell. A hole indicates that the 850 // Load the payload of the global parameter cell. A hole indicates that the
851 // property has been deleted and that the store must be handled by the 851 // property has been deleted and that the store must be handled by the
852 // runtime. 852 // runtime.
853 IfBuilder builder(this); 853 IfBuilder builder(this);
854 HValue* hole_value = Add<HConstant>(hole); 854 HValue* hole_value = Add<HConstant>(hole);
855 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value); 855 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
856 builder.Then(); 856 builder.Then();
857 builder.Deopt(); 857 builder.Deopt("Unexpected cell contents in global store");
858 builder.Else(); 858 builder.Else();
859 Add<HStoreNamedField>(cell, access, value); 859 Add<HStoreNamedField>(cell, access, value);
860 builder.End(); 860 builder.End();
861 } 861 }
862 862
863 return value; 863 return value;
864 } 864 }
865 865
866 866
867 Handle<Code> StoreGlobalStub::GenerateCode() { 867 Handle<Code> StoreGlobalStub::GenerateCode() {
868 return DoGenerateCode(this); 868 return DoGenerateCode(this);
869 } 869 }
870 870
871 871
872 template<> 872 template<>
873 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { 873 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
874 HValue* value = GetParameter(0); 874 HValue* value = GetParameter(0);
875 HValue* map = GetParameter(1); 875 HValue* map = GetParameter(1);
876 HValue* key = GetParameter(2); 876 HValue* key = GetParameter(2);
877 HValue* object = GetParameter(3); 877 HValue* object = GetParameter(3);
878 878
879 if (FLAG_trace_elements_transitions) { 879 if (FLAG_trace_elements_transitions) {
880 // Tracing elements transitions is the job of the runtime. 880 // Tracing elements transitions is the job of the runtime.
881 Add<HDeoptimize>(Deoptimizer::EAGER); 881 Add<HDeoptimize>("Deopt due to --trace-elements-transitions",
882 Deoptimizer::EAGER);
882 } else { 883 } else {
883 info()->MarkAsSavesCallerDoubles(); 884 info()->MarkAsSavesCallerDoubles();
884 885
885 BuildTransitionElementsKind(object, map, 886 BuildTransitionElementsKind(object, map,
886 casted_stub()->from_kind(), 887 casted_stub()->from_kind(),
887 casted_stub()->to_kind(), 888 casted_stub()->to_kind(),
888 casted_stub()->is_jsarray()); 889 casted_stub()->is_jsarray());
889 890
890 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL, 891 BuildUncheckedMonomorphicElementAccess(object, key, value, NULL,
891 casted_stub()->is_jsarray(), 892 casted_stub()->is_jsarray(),
892 casted_stub()->to_kind(), 893 casted_stub()->to_kind(),
893 true, ALLOW_RETURN_HOLE, 894 true, ALLOW_RETURN_HOLE,
894 casted_stub()->store_mode()); 895 casted_stub()->store_mode());
895 } 896 }
896 897
897 return value; 898 return value;
898 } 899 }
899 900
900 901
901 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { 902 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() {
902 return DoGenerateCode(this); 903 return DoGenerateCode(this);
903 } 904 }
904 905
905 906
906 } } // namespace v8::internal 907 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698