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

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

Issue 272243002: Revert "Reland r20974: Unify and simplify the FastCloneShallowArrayStub" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/compiler.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 // 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "code-stubs.h" 7 #include "code-stubs.h"
8 #include "hydrogen.h" 8 #include "hydrogen.h"
9 #include "lithium.h" 9 #include "lithium.h"
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 int param_count = descriptor_->register_param_count_; 120 int param_count = descriptor_->register_param_count_;
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_->register_param_representations_ == NULL 130 Representation r = descriptor_->IsParameterCountRegister(i)
131 ? Representation::Tagged() 131 ? Representation::Integer32()
132 : descriptor_->register_param_representations_[i]; 132 : Representation::Tagged();
133 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); 133 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r);
134 start_environment->Bind(i, param); 134 start_environment->Bind(i, param);
135 parameters_[i] = param; 135 parameters_[i] = param;
136 if (descriptor_->IsParameterCountRegister(i)) { 136 if (descriptor_->IsParameterCountRegister(i)) {
137 param->set_type(HType::Smi()); 137 param->set_type(HType::Smi());
138 stack_parameter_count = param; 138 stack_parameter_count = param;
139 arguments_length_ = stack_parameter_count; 139 arguments_length_ = stack_parameter_count;
140 } 140 }
141 } 141 }
142 142
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 Handle<Code> NumberToStringStub::GenerateCode() { 323 Handle<Code> NumberToStringStub::GenerateCode() {
324 return DoGenerateCode(this); 324 return DoGenerateCode(this);
325 } 325 }
326 326
327 327
328 template <> 328 template <>
329 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 329 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
330 Factory* factory = isolate()->factory(); 330 Factory* factory = isolate()->factory();
331 HValue* undefined = graph()->GetConstantUndefined(); 331 HValue* undefined = graph()->GetConstantUndefined();
332 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); 332 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
333 333 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
334 // This stub is very performance sensitive, the generated code must be tuned 334 int length = casted_stub()->length();
335 // so that it doesn't build and eager frame.
336 info()->MarkMustNotHaveEagerFrame();
337 335
338 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), 336 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0),
339 GetParameter(1), 337 GetParameter(1),
340 static_cast<HValue*>(NULL), 338 static_cast<HValue*>(NULL),
341 FAST_ELEMENTS); 339 FAST_ELEMENTS);
342 IfBuilder checker(this); 340 IfBuilder checker(this);
343 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, 341 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
344 undefined); 342 undefined);
345 checker.Then(); 343 checker.Then();
346 344
347 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( 345 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
348 AllocationSite::kTransitionInfoOffset); 346 AllocationSite::kTransitionInfoOffset);
349 HInstruction* boilerplate = Add<HLoadNamedField>( 347 HInstruction* boilerplate = Add<HLoadNamedField>(
350 allocation_site, static_cast<HValue*>(NULL), access); 348 allocation_site, static_cast<HValue*>(NULL), access);
351 HValue* elements = AddLoadElements(boilerplate); 349 HValue* push_value;
352 HValue* capacity = AddLoadFixedArrayLength(elements); 350 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
353 IfBuilder zero_capacity(this); 351 HValue* elements = AddLoadElements(boilerplate);
354 zero_capacity.If<HCompareNumericAndBranch>(capacity, graph()->GetConstant0(),
355 Token::EQ);
356 zero_capacity.Then();
357 Push(BuildCloneShallowArrayEmpty(boilerplate,
358 allocation_site,
359 alloc_site_mode));
360 zero_capacity.Else();
361 IfBuilder if_fixed_cow(this);
362 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map());
363 if_fixed_cow.Then();
364 Push(BuildCloneShallowArrayCow(boilerplate,
365 allocation_site,
366 alloc_site_mode,
367 FAST_ELEMENTS));
368 if_fixed_cow.Else();
369 IfBuilder if_fixed(this);
370 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map());
371 if_fixed.Then();
372 Push(BuildCloneShallowArrayNonEmpty(boilerplate,
373 allocation_site,
374 alloc_site_mode,
375 FAST_ELEMENTS));
376 352
377 if_fixed.Else(); 353 IfBuilder if_fixed_cow(this);
378 Push(BuildCloneShallowArrayNonEmpty(boilerplate, 354 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map());
379 allocation_site, 355 if_fixed_cow.Then();
380 alloc_site_mode, 356 push_value = BuildCloneShallowArray(boilerplate,
381 FAST_DOUBLE_ELEMENTS)); 357 allocation_site,
382 if_fixed.End(); 358 alloc_site_mode,
383 if_fixed_cow.End(); 359 FAST_ELEMENTS,
384 zero_capacity.End(); 360 0/*copy-on-write*/);
361 environment()->Push(push_value);
362 if_fixed_cow.Else();
363
364 IfBuilder if_fixed(this);
365 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map());
366 if_fixed.Then();
367 push_value = BuildCloneShallowArray(boilerplate,
368 allocation_site,
369 alloc_site_mode,
370 FAST_ELEMENTS,
371 length);
372 environment()->Push(push_value);
373 if_fixed.Else();
374 push_value = BuildCloneShallowArray(boilerplate,
375 allocation_site,
376 alloc_site_mode,
377 FAST_DOUBLE_ELEMENTS,
378 length);
379 environment()->Push(push_value);
380 } else {
381 ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
382 push_value = BuildCloneShallowArray(boilerplate,
383 allocation_site,
384 alloc_site_mode,
385 elements_kind,
386 length);
387 environment()->Push(push_value);
388 }
385 389
386 checker.ElseDeopt("Uninitialized boilerplate literals"); 390 checker.ElseDeopt("Uninitialized boilerplate literals");
387 checker.End(); 391 checker.End();
388 392
389 return environment()->Pop(); 393 return environment()->Pop();
390 } 394 }
391 395
392 396
393 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { 397 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
394 return DoGenerateCode(this); 398 return DoGenerateCode(this);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 ElementsKind kind, 637 ElementsKind kind,
634 AllocationSiteOverrideMode override_mode, 638 AllocationSiteOverrideMode override_mode,
635 ArgumentClass argument_class) { 639 ArgumentClass argument_class) {
636 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); 640 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor);
637 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite); 641 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite);
638 JSArrayBuilder array_builder(this, kind, alloc_site, constructor, 642 JSArrayBuilder array_builder(this, kind, alloc_site, constructor,
639 override_mode); 643 override_mode);
640 HValue* result = NULL; 644 HValue* result = NULL;
641 switch (argument_class) { 645 switch (argument_class) {
642 case NONE: 646 case NONE:
643 // This stub is very performance sensitive, the generated code must be
644 // tuned so that it doesn't build and eager frame.
645 info()->MarkMustNotHaveEagerFrame();
646 result = array_builder.AllocateEmptyArray(); 647 result = array_builder.AllocateEmptyArray();
647 break; 648 break;
648 case SINGLE: 649 case SINGLE:
649 result = BuildArraySingleArgumentConstructor(&array_builder); 650 result = BuildArraySingleArgumentConstructor(&array_builder);
650 break; 651 break;
651 case MULTIPLE: 652 case MULTIPLE:
652 result = BuildArrayNArgumentsConstructor(&array_builder, kind); 653 result = BuildArrayNArgumentsConstructor(&array_builder, kind);
653 break; 654 break;
654 } 655 }
655 656
656 return result; 657 return result;
657 } 658 }
658 659
659 660
660 HValue* CodeStubGraphBuilderBase::BuildInternalArrayConstructor( 661 HValue* CodeStubGraphBuilderBase::BuildInternalArrayConstructor(
661 ElementsKind kind, ArgumentClass argument_class) { 662 ElementsKind kind, ArgumentClass argument_class) {
662 HValue* constructor = GetParameter( 663 HValue* constructor = GetParameter(
663 InternalArrayConstructorStubBase::kConstructor); 664 InternalArrayConstructorStubBase::kConstructor);
664 JSArrayBuilder array_builder(this, kind, constructor); 665 JSArrayBuilder array_builder(this, kind, constructor);
665 666
666 HValue* result = NULL; 667 HValue* result = NULL;
667 switch (argument_class) { 668 switch (argument_class) {
668 case NONE: 669 case NONE:
669 // This stub is very performance sensitive, the generated code must be
670 // tuned so that it doesn't build and eager frame.
671 info()->MarkMustNotHaveEagerFrame();
672 result = array_builder.AllocateEmptyArray(); 670 result = array_builder.AllocateEmptyArray();
673 break; 671 break;
674 case SINGLE: 672 case SINGLE:
675 result = BuildArraySingleArgumentConstructor(&array_builder); 673 result = BuildArraySingleArgumentConstructor(&array_builder);
676 break; 674 break;
677 case MULTIPLE: 675 case MULTIPLE:
678 result = BuildArrayNArgumentsConstructor(&array_builder, kind); 676 result = BuildArrayNArgumentsConstructor(&array_builder, kind);
679 break; 677 break;
680 } 678 }
681 return result; 679 return result;
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 return BuildRegExpConstructResult(length, index, input); 1484 return BuildRegExpConstructResult(length, index, input);
1487 } 1485 }
1488 1486
1489 1487
1490 Handle<Code> RegExpConstructResultStub::GenerateCode() { 1488 Handle<Code> RegExpConstructResultStub::GenerateCode() {
1491 return DoGenerateCode(this); 1489 return DoGenerateCode(this);
1492 } 1490 }
1493 1491
1494 1492
1495 } } // namespace v8::internal 1493 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698