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

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

Issue 137203010: Merged r18116 into 3.22 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.22
Patch Set: Created 6 years, 11 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 | src/version.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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 // Figure out total size 715 // Figure out total size
716 HValue* length = Pop(); 716 HValue* length = Pop();
717 HValue* capacity = Pop(); 717 HValue* capacity = Pop();
718 return array_builder->AllocateArray(capacity, length, true); 718 return array_builder->AllocateArray(capacity, length, true);
719 } 719 }
720 720
721 721
722 HValue* CodeStubGraphBuilderBase::BuildArrayNArgumentsConstructor( 722 HValue* CodeStubGraphBuilderBase::BuildArrayNArgumentsConstructor(
723 JSArrayBuilder* array_builder, ElementsKind kind) { 723 JSArrayBuilder* array_builder, ElementsKind kind) {
724 // Insert a bounds check because the number of arguments might exceed
725 // the kInitialMaxFastElementArray limit. This cannot happen for code
726 // that was parsed, but calling via Array.apply(thisArg, [...]) might
727 // trigger it.
728 HValue* length = GetArgumentsLength();
729 HConstant* max_alloc_length =
730 Add<HConstant>(JSObject::kInitialMaxFastElementArray);
731 HValue* checked_length = Add<HBoundsCheck>(length, max_alloc_length);
732
724 // We need to fill with the hole if it's a smi array in the multi-argument 733 // We need to fill with the hole if it's a smi array in the multi-argument
725 // case because we might have to bail out while copying arguments into 734 // case because we might have to bail out while copying arguments into
726 // the array because they aren't compatible with a smi array. 735 // the array because they aren't compatible with a smi array.
727 // If it's a double array, no problem, and if it's fast then no 736 // If it's a double array, no problem, and if it's fast then no
728 // problem either because doubles are boxed. 737 // problem either because doubles are boxed.
729 HValue* length = GetArgumentsLength();
730 bool fill_with_hole = IsFastSmiElementsKind(kind); 738 bool fill_with_hole = IsFastSmiElementsKind(kind);
731 HValue* new_object = array_builder->AllocateArray(length, 739 HValue* new_object = array_builder->AllocateArray(checked_length,
732 length, 740 checked_length,
733 fill_with_hole); 741 fill_with_hole);
734 HValue* elements = array_builder->GetElementsLocation(); 742 HValue* elements = array_builder->GetElementsLocation();
735 ASSERT(elements != NULL); 743 ASSERT(elements != NULL);
736 744
737 // Now populate the elements correctly. 745 // Now populate the elements correctly.
738 LoopBuilder builder(this, 746 LoopBuilder builder(this,
739 context(), 747 context(),
740 LoopBuilder::kPostIncrement); 748 LoopBuilder::kPostIncrement);
741 HValue* start = graph()->GetConstant0(); 749 HValue* start = graph()->GetConstant0();
742 HValue* key = builder.BeginBody(start, length, Token::LT); 750 HValue* key = builder.BeginBody(start, checked_length, Token::LT);
743 HInstruction* argument_elements = Add<HArgumentsElements>(false); 751 HInstruction* argument_elements = Add<HArgumentsElements>(false);
744 HInstruction* argument = Add<HAccessArgumentsAt>( 752 HInstruction* argument = Add<HAccessArgumentsAt>(
745 argument_elements, length, key); 753 argument_elements, checked_length, key);
746 754
747 Add<HStoreKeyed>(elements, key, argument, kind); 755 Add<HStoreKeyed>(elements, key, argument, kind);
748 builder.EndBody(); 756 builder.EndBody();
749 return new_object; 757 return new_object;
750 } 758 }
751 759
752 760
753 template <> 761 template <>
754 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { 762 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() {
755 ElementsKind kind = casted_stub()->elements_kind(); 763 ElementsKind kind = casted_stub()->elements_kind();
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 return js_function; 1263 return js_function;
1256 } 1264 }
1257 1265
1258 1266
1259 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { 1267 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) {
1260 return DoGenerateCode(isolate, this); 1268 return DoGenerateCode(isolate, this);
1261 } 1269 }
1262 1270
1263 1271
1264 } } // namespace v8::internal 1272 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698