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

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

Issue 256873007: Revert 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/hydrogen.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 // 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 int param_count = descriptor_->register_param_count_; 143 int param_count = descriptor_->register_param_count_;
144 HEnvironment* start_environment = graph()->start_environment(); 144 HEnvironment* start_environment = graph()->start_environment();
145 HBasicBlock* next_block = CreateBasicBlock(start_environment); 145 HBasicBlock* next_block = CreateBasicBlock(start_environment);
146 Goto(next_block); 146 Goto(next_block);
147 next_block->SetJoinId(BailoutId::StubEntry()); 147 next_block->SetJoinId(BailoutId::StubEntry());
148 set_current_block(next_block); 148 set_current_block(next_block);
149 149
150 bool runtime_stack_params = descriptor_->stack_parameter_count_.is_valid(); 150 bool runtime_stack_params = descriptor_->stack_parameter_count_.is_valid();
151 HInstruction* stack_parameter_count = NULL; 151 HInstruction* stack_parameter_count = NULL;
152 for (int i = 0; i < param_count; ++i) { 152 for (int i = 0; i < param_count; ++i) {
153 Representation r = descriptor_->register_param_representations_ == NULL 153 Representation r = descriptor_->IsParameterCountRegister(i)
154 ? Representation::Tagged() 154 ? Representation::Integer32()
155 : descriptor_->register_param_representations_[i]; 155 : Representation::Tagged();
156 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r); 156 HParameter* param = Add<HParameter>(i, HParameter::REGISTER_PARAMETER, r);
157 start_environment->Bind(i, param); 157 start_environment->Bind(i, param);
158 parameters_[i] = param; 158 parameters_[i] = param;
159 if (descriptor_->IsParameterCountRegister(i)) { 159 if (descriptor_->IsParameterCountRegister(i)) {
160 param->set_type(HType::Smi()); 160 param->set_type(HType::Smi());
161 stack_parameter_count = param; 161 stack_parameter_count = param;
162 arguments_length_ = stack_parameter_count; 162 arguments_length_ = stack_parameter_count;
163 } 163 }
164 } 164 }
165 165
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 Handle<Code> NumberToStringStub::GenerateCode() { 346 Handle<Code> NumberToStringStub::GenerateCode() {
347 return DoGenerateCode(this); 347 return DoGenerateCode(this);
348 } 348 }
349 349
350 350
351 template <> 351 template <>
352 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 352 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
353 Factory* factory = isolate()->factory(); 353 Factory* factory = isolate()->factory();
354 HValue* undefined = graph()->GetConstantUndefined(); 354 HValue* undefined = graph()->GetConstantUndefined();
355 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); 355 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
356 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
357 int length = casted_stub()->length();
356 358
357 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), 359 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0),
358 GetParameter(1), 360 GetParameter(1),
359 static_cast<HValue*>(NULL), 361 static_cast<HValue*>(NULL),
360 FAST_ELEMENTS); 362 FAST_ELEMENTS);
361 IfBuilder checker(this); 363 IfBuilder checker(this);
362 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, 364 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
363 undefined); 365 undefined);
364 checker.Then(); 366 checker.Then();
365 367
366 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( 368 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
367 AllocationSite::kTransitionInfoOffset); 369 AllocationSite::kTransitionInfoOffset);
368 HInstruction* boilerplate = Add<HLoadNamedField>( 370 HInstruction* boilerplate = Add<HLoadNamedField>(
369 allocation_site, static_cast<HValue*>(NULL), access); 371 allocation_site, static_cast<HValue*>(NULL), access);
370 HValue* elements = AddLoadElements(boilerplate); 372 HValue* push_value;
371 HValue* capacity = AddLoadFixedArrayLength(elements); 373 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) {
372 IfBuilder zero_capacity(this); 374 HValue* elements = AddLoadElements(boilerplate);
373 zero_capacity.If<HCompareNumericAndBranch>(capacity, graph()->GetConstant0(),
374 Token::EQ);
375 zero_capacity.Then();
376 Push(BuildCloneShallowArrayEmpty(boilerplate,
377 allocation_site,
378 alloc_site_mode));
379 zero_capacity.Else();
380 IfBuilder if_fixed_cow(this);
381 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map());
382 if_fixed_cow.Then();
383 Push(BuildCloneShallowArrayCow(boilerplate,
384 allocation_site,
385 alloc_site_mode,
386 FAST_ELEMENTS));
387 if_fixed_cow.Else();
388 IfBuilder if_fixed(this);
389 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map());
390 if_fixed.Then();
391 Push(BuildCloneShallowArrayNonEmpty(boilerplate,
392 allocation_site,
393 alloc_site_mode,
394 FAST_ELEMENTS));
395 375
396 if_fixed.Else(); 376 IfBuilder if_fixed_cow(this);
397 Push(BuildCloneShallowArrayNonEmpty(boilerplate, 377 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map());
398 allocation_site, 378 if_fixed_cow.Then();
399 alloc_site_mode, 379 push_value = BuildCloneShallowArray(boilerplate,
400 FAST_DOUBLE_ELEMENTS)); 380 allocation_site,
401 if_fixed.End(); 381 alloc_site_mode,
402 if_fixed_cow.End(); 382 FAST_ELEMENTS,
403 zero_capacity.End(); 383 0/*copy-on-write*/);
384 environment()->Push(push_value);
385 if_fixed_cow.Else();
386
387 IfBuilder if_fixed(this);
388 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map());
389 if_fixed.Then();
390 push_value = BuildCloneShallowArray(boilerplate,
391 allocation_site,
392 alloc_site_mode,
393 FAST_ELEMENTS,
394 length);
395 environment()->Push(push_value);
396 if_fixed.Else();
397 push_value = BuildCloneShallowArray(boilerplate,
398 allocation_site,
399 alloc_site_mode,
400 FAST_DOUBLE_ELEMENTS,
401 length);
402 environment()->Push(push_value);
403 } else {
404 ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
405 push_value = BuildCloneShallowArray(boilerplate,
406 allocation_site,
407 alloc_site_mode,
408 elements_kind,
409 length);
410 environment()->Push(push_value);
411 }
404 412
405 checker.ElseDeopt("Uninitialized boilerplate literals"); 413 checker.ElseDeopt("Uninitialized boilerplate literals");
406 checker.End(); 414 checker.End();
407 415
408 return environment()->Pop(); 416 return environment()->Pop();
409 } 417 }
410 418
411 419
412 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { 420 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
413 return DoGenerateCode(this); 421 return DoGenerateCode(this);
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 return BuildRegExpConstructResult(length, index, input); 1427 return BuildRegExpConstructResult(length, index, input);
1420 } 1428 }
1421 1429
1422 1430
1423 Handle<Code> RegExpConstructResultStub::GenerateCode() { 1431 Handle<Code> RegExpConstructResultStub::GenerateCode() {
1424 return DoGenerateCode(this); 1432 return DoGenerateCode(this);
1425 } 1433 }
1426 1434
1427 1435
1428 } } // namespace v8::internal 1436 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698