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

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: REBASE 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 | test/mjsunit/transition-elements-kind.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 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* array_length = 544 HInstruction* elements = AddLoadElements(js_array);
545 AddLoad(js_array, HObjectAccess::ForArrayLength()); 545
546 array_length->set_type(HType::Smi()); 546 HInstruction* empty_fixed_array = Add<HConstant>(
547 isolate()->factory()->empty_fixed_array(), Representation::Tagged());
547 548
548 IfBuilder if_builder(this); 549 IfBuilder if_builder(this);
549 550
550 if_builder.IfNot<HCompareNumericAndBranch>(array_length, 551 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array);
551 graph()->GetConstant0(), 552
552 Token::EQ);
553 if_builder.Then(); 553 if_builder.Then();
554 554
555 HInstruction* elements = AddLoadElements(js_array); 555 HInstruction* elements_length = AddLoadFixedArrayLength(elements);
556 556
557 HInstruction* elements_length = AddLoadFixedArrayLength(elements); 557 HInstruction* array_length = AddLoad(
558 js_array, HObjectAccess::ForArrayLength(), NULL, Representation::Smi());
559 array_length->set_type(HType::Smi());
558 560
559 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind, 561 BuildGrowElementsCapacity(js_array, elements, from_kind, to_kind,
560 array_length, elements_length); 562 array_length, elements_length);
561 563
562 if_builder.End(); 564 if_builder.End();
563 565
564 AddStore(js_array, HObjectAccess::ForMap(), map); 566 AddStore(js_array, HObjectAccess::ForMap(), map);
565 567
566 return js_array; 568 return js_array;
567 } 569 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 return value; 904 return value;
903 } 905 }
904 906
905 907
906 Handle<Code> StoreGlobalStub::GenerateCode() { 908 Handle<Code> StoreGlobalStub::GenerateCode() {
907 return DoGenerateCode(this); 909 return DoGenerateCode(this);
908 } 910 }
909 911
910 912
911 } } // namespace v8::internal 913 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/transition-elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698