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

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

Issue 19289009: Fix invalid array length check in TransitionElementsKindStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « no previous file | no next file » | 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 HValue* js_array = GetParameter(0); 535 HValue* js_array = GetParameter(0);
536 HValue* map = GetParameter(1); 536 HValue* map = GetParameter(1);
537 537
538 info()->MarkAsSavesCallerDoubles(); 538 info()->MarkAsSavesCallerDoubles();
539 539
540 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) { 540 if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
541 Add<HTrapAllocationMemento>(js_array); 541 Add<HTrapAllocationMemento>(js_array);
542 } 542 }
543 543
544 HInstruction* elements = AddLoadElements(js_array);
545
546 HInstruction* elements_length = AddLoadFixedArrayLength(elements);
547
548 IfBuilder if_builder(this);
549
550 if_builder.IfNot<HCompareNumericAndBranch>(elements_length,
551 graph()->GetConstant0(),
552 Token::EQ);
553 if_builder.Then();
mvstanton 2013/07/16 13:01:07 There might still be an issue here. What if you ar
554
544 HInstruction* array_length = 555 HInstruction* array_length =
545 AddLoad(js_array, HObjectAccess::ForArrayLength()); 556 AddLoad(js_array, HObjectAccess::ForArrayLength());
546 array_length->set_type(HType::Smi()); 557 array_length->set_type(HType::Smi());
547 558
548 IfBuilder if_builder(this);
549
550 if_builder.IfNot<HCompareNumericAndBranch>(array_length,
551 graph()->GetConstant0(),
552 Token::EQ);
553 if_builder.Then();
554
555 HInstruction* elements = AddLoadElements(js_array);
556
557 HInstruction* elements_length = AddLoadFixedArrayLength(elements);
558
559 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind, 559 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind,
560 array_length, elements_length); 560 array_length, elements_length);
561 561
562 if_builder.End(); 562 if_builder.End();
563 563
564 AddStore(js_array, HObjectAccess::ForMap(), map); 564 AddStore(js_array, HObjectAccess::ForMap(), map);
565 565
566 return js_array; 566 return js_array;
567 } 567 }
568 568
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 return value; 902 return value;
903 } 903 }
904 904
905 905
906 Handle<Code> StoreGlobalStub::GenerateCode() { 906 Handle<Code> StoreGlobalStub::GenerateCode() {
907 return DoGenerateCode(this); 907 return DoGenerateCode(this);
908 } 908 }
909 909
910 910
911 } } // namespace v8::internal 911 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698