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

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

Issue 368263003: Use a stub in crankshaft for grow store arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed remaining issues. Created 6 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 | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | src/runtime.cc » ('J')
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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/field-index.h" 8 #include "src/field-index.h"
9 #include "src/hydrogen.h" 9 #include "src/hydrogen.h"
10 #include "src/lithium.h" 10 #include "src/lithium.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 HEnvironment* start_environment = graph()->start_environment(); 121 HEnvironment* start_environment = graph()->start_environment();
122 HBasicBlock* next_block = CreateBasicBlock(start_environment); 122 HBasicBlock* next_block = CreateBasicBlock(start_environment);
123 Goto(next_block); 123 Goto(next_block);
124 next_block->SetJoinId(BailoutId::StubEntry()); 124 next_block->SetJoinId(BailoutId::StubEntry());
125 set_current_block(next_block); 125 set_current_block(next_block);
126 126
127 bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid(); 127 bool runtime_stack_params = descriptor_->stack_parameter_count().is_valid();
128 HInstruction* stack_parameter_count = NULL; 128 HInstruction* stack_parameter_count = NULL;
129 for (int i = 0; i < param_count; ++i) { 129 for (int i = 0; i < param_count; ++i) {
130 Representation r = descriptor_->GetEnvironmentParameterRepresentation(i); 130 Representation r = descriptor_->GetEnvironmentParameterRepresentation(i);
131 HParameter* param = Add<HParameter>(i, 131 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r);
132 HParameter::REGISTER_PARAMETER, r);
133 start_environment->Bind(i, param); 132 start_environment->Bind(i, param);
134 parameters_[i] = param; 133 parameters_[i] = param;
135 if (descriptor_->IsEnvironmentParameterCountRegister(i)) { 134 if (descriptor_->IsEnvironmentParameterCountRegister(i)) {
136 param->set_type(HType::Smi()); 135 param->set_type(HType::Smi());
137 stack_parameter_count = param; 136 stack_parameter_count = param;
138 arguments_length_ = stack_parameter_count; 137 arguments_length_ = stack_parameter_count;
139 } 138 }
140 } 139 }
141 140
142 ASSERT(!runtime_stack_params || arguments_length_ != NULL); 141 ASSERT(!runtime_stack_params || arguments_length_ != NULL);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 return feedback_vector; 529 return feedback_vector;
531 } 530 }
532 531
533 532
534 Handle<Code> CreateAllocationSiteStub::GenerateCode() { 533 Handle<Code> CreateAllocationSiteStub::GenerateCode() {
535 return DoGenerateCode(this); 534 return DoGenerateCode(this);
536 } 535 }
537 536
538 537
539 template <> 538 template <>
539 HValue* CodeStubGraphBuilder<GrowArrayElementsStub>::BuildCodeStub() {
540 HValue* object = GetParameter(GrowArrayElementsStub::kObjectIndex);
541 HValue* key = GetParameter(GrowArrayElementsStub::kKeyIndex);
542 HValue* current_capacity = GetParameter(
543 GrowArrayElementsStub::kCapacityIndex);
544 ElementsKind kind = casted_stub()->elements_kind();
545
546 HValue* elements = AddLoadElements(object);
547 HValue* length = casted_stub()->is_js_array()
548 ? Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
549 HObjectAccess::ForArrayLength(kind))
550 : current_capacity;
551
552 return BuildCheckAndGrowElementsCapacity(object, elements, kind, length,
553 current_capacity, key);
554 }
555
556
557 Handle<Code> GrowArrayElementsStub::GenerateCode() {
558 return DoGenerateCode(this);
559 }
560
561
562 template <>
540 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { 563 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
541 HInstruction* load = BuildUncheckedMonomorphicElementAccess( 564 HInstruction* load = BuildUncheckedMonomorphicElementAccess(
542 GetParameter(KeyedLoadIC::kReceiverIndex), 565 GetParameter(KeyedLoadIC::kReceiverIndex),
543 GetParameter(KeyedLoadIC::kNameIndex), 566 GetParameter(KeyedLoadIC::kNameIndex),
544 NULL, 567 NULL,
545 casted_stub()->is_js_array(), 568 casted_stub()->is_js_array(),
546 casted_stub()->elements_kind(), 569 casted_stub()->elements_kind(),
547 LOAD, 570 LOAD,
548 NEVER_RETURN_HOLE, 571 NEVER_RETURN_HOLE,
549 STANDARD_STORE); 572 STANDARD_STORE);
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 return Pop(); 1750 return Pop();
1728 } 1751 }
1729 1752
1730 1753
1731 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() { 1754 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() {
1732 return DoGenerateCode(this); 1755 return DoGenerateCode(this);
1733 } 1756 }
1734 1757
1735 1758
1736 } } // namespace v8::internal 1759 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698