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

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

Issue 257563004: Unify and simplify the FastCloneShallowArrayStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix arm64 Created 6 years, 8 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
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_->IsParameterCountRegister(i) 153 Representation r = descriptor_->register_param_representations_ == NULL
154 ? Representation::Integer32() 154 ? Representation::Tagged()
155 : Representation::Tagged(); 155 : descriptor_->register_param_representations_[i];
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { 345 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) {
346 return DoGenerateCode(isolate, this); 346 return DoGenerateCode(isolate, this);
347 } 347 }
348 348
349 349
350 template <> 350 template <>
351 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 351 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
352 Factory* factory = isolate()->factory(); 352 Factory* factory = isolate()->factory();
353 HValue* undefined = graph()->GetConstantUndefined(); 353 HValue* undefined = graph()->GetConstantUndefined();
354 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); 354 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
355 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
356 int length = casted_stub()->length();
357 355
358 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), 356 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0),
359 GetParameter(1), 357 GetParameter(1),
360 static_cast<HValue*>(NULL), 358 static_cast<HValue*>(NULL),
361 FAST_ELEMENTS); 359 FAST_ELEMENTS);
362 IfBuilder checker(this); 360 IfBuilder checker(this);
363 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, 361 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
364 undefined); 362 undefined);
365 checker.Then(); 363 checker.Then();
366 364
367 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( 365 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
368 AllocationSite::kTransitionInfoOffset); 366 AllocationSite::kTransitionInfoOffset);
369 HInstruction* boilerplate = Add<HLoadNamedField>( 367 HInstruction* boilerplate = Add<HLoadNamedField>(
370 allocation_site, static_cast<HValue*>(NULL), access); 368 allocation_site, static_cast<HValue*>(NULL), access);
371 HValue* push_value; 369 HValue* elements = AddLoadElements(boilerplate);
372 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { 370 HValue* capacity = AddLoadFixedArrayLength(elements);
373 HValue* elements = AddLoadElements(boilerplate); 371 IfBuilder zero_capacity(this);
372 zero_capacity.If<HCompareNumericAndBranch>(capacity, graph()->GetConstant0(),
373 Token::EQ);
374 zero_capacity.Then();
375 Push(BuildCloneShallowArrayEmpty(boilerplate,
376 allocation_site,
377 alloc_site_mode));
378 zero_capacity.Else();
379 IfBuilder if_fixed_cow(this);
380 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map());
381 if_fixed_cow.Then();
382 Push(BuildCloneShallowArrayCow(boilerplate,
383 allocation_site,
384 alloc_site_mode,
385 FAST_ELEMENTS));
386 if_fixed_cow.Else();
387 IfBuilder if_fixed(this);
388 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map());
389 if_fixed.Then();
390 Push(BuildCloneShallowArrayNonEmpty(boilerplate,
391 allocation_site,
392 alloc_site_mode,
393 FAST_ELEMENTS));
374 394
375 IfBuilder if_fixed_cow(this); 395 if_fixed.Else();
376 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); 396 Push(BuildCloneShallowArrayNonEmpty(boilerplate,
377 if_fixed_cow.Then(); 397 allocation_site,
378 push_value = BuildCloneShallowArray(boilerplate, 398 alloc_site_mode,
379 allocation_site, 399 FAST_DOUBLE_ELEMENTS));
380 alloc_site_mode, 400 if_fixed.End();
381 FAST_ELEMENTS, 401 if_fixed_cow.End();
382 0/*copy-on-write*/); 402 zero_capacity.End();
383 environment()->Push(push_value);
384 if_fixed_cow.Else();
385
386 IfBuilder if_fixed(this);
387 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map());
388 if_fixed.Then();
389 push_value = BuildCloneShallowArray(boilerplate,
390 allocation_site,
391 alloc_site_mode,
392 FAST_ELEMENTS,
393 length);
394 environment()->Push(push_value);
395 if_fixed.Else();
396 push_value = BuildCloneShallowArray(boilerplate,
397 allocation_site,
398 alloc_site_mode,
399 FAST_DOUBLE_ELEMENTS,
400 length);
401 environment()->Push(push_value);
402 } else {
403 ElementsKind elements_kind = casted_stub()->ComputeElementsKind();
404 push_value = BuildCloneShallowArray(boilerplate,
405 allocation_site,
406 alloc_site_mode,
407 elements_kind,
408 length);
409 environment()->Push(push_value);
410 }
411 403
412 checker.ElseDeopt("Uninitialized boilerplate literals"); 404 checker.ElseDeopt("Uninitialized boilerplate literals");
413 checker.End(); 405 checker.End();
414 406
415 return environment()->Pop(); 407 return environment()->Pop();
416 } 408 }
417 409
418 410
419 Handle<Code> FastCloneShallowArrayStub::GenerateCode(Isolate* isolate) { 411 Handle<Code> FastCloneShallowArrayStub::GenerateCode(Isolate* isolate) {
420 return DoGenerateCode(isolate, this); 412 return DoGenerateCode(isolate, this);
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 return BuildRegExpConstructResult(length, index, input); 1422 return BuildRegExpConstructResult(length, index, input);
1431 } 1423 }
1432 1424
1433 1425
1434 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { 1426 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) {
1435 return DoGenerateCode(isolate, this); 1427 return DoGenerateCode(isolate, this);
1436 } 1428 }
1437 1429
1438 1430
1439 } } // namespace v8::internal 1431 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/hydrogen.h » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698