| OLD | NEW |
| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), | 365 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), |
| 366 GetParameter(1), | 366 GetParameter(1), |
| 367 static_cast<HValue*>(NULL), | 367 static_cast<HValue*>(NULL), |
| 368 FAST_ELEMENTS); | 368 FAST_ELEMENTS); |
| 369 IfBuilder checker(this); | 369 IfBuilder checker(this); |
| 370 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, | 370 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, |
| 371 undefined); | 371 undefined); |
| 372 checker.Then(); | 372 checker.Then(); |
| 373 | 373 |
| 374 HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo(); | 374 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( |
| 375 AllocationSite::kTransitionInfoOffset); |
| 375 HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); | 376 HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); |
| 376 HValue* push_value; | 377 HValue* push_value; |
| 377 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { | 378 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
| 378 HValue* elements = AddLoadElements(boilerplate); | 379 HValue* elements = AddLoadElements(boilerplate); |
| 379 | 380 |
| 380 IfBuilder if_fixed_cow(this); | 381 IfBuilder if_fixed_cow(this); |
| 381 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); | 382 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); |
| 382 if_fixed_cow.Then(); | 383 if_fixed_cow.Then(); |
| 383 push_value = BuildCloneShallowArray(boilerplate, | 384 push_value = BuildCloneShallowArray(boilerplate, |
| 384 allocation_site, | 385 allocation_site, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), | 434 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), |
| 434 GetParameter(1), | 435 GetParameter(1), |
| 435 static_cast<HValue*>(NULL), | 436 static_cast<HValue*>(NULL), |
| 436 FAST_ELEMENTS); | 437 FAST_ELEMENTS); |
| 437 | 438 |
| 438 IfBuilder checker(this); | 439 IfBuilder checker(this); |
| 439 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, | 440 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, |
| 440 undefined); | 441 undefined); |
| 441 checker.And(); | 442 checker.And(); |
| 442 | 443 |
| 443 HObjectAccess access = HObjectAccess::ForAllocationSiteTransitionInfo(); | 444 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( |
| 445 AllocationSite::kTransitionInfoOffset); |
| 444 HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); | 446 HInstruction* boilerplate = Add<HLoadNamedField>(allocation_site, access); |
| 445 | 447 |
| 446 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 448 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
| 447 int object_size = size; | 449 int object_size = size; |
| 448 if (FLAG_allocation_site_pretenuring) { | 450 if (FLAG_allocation_site_pretenuring) { |
| 449 size += AllocationMemento::kSize; | 451 size += AllocationMemento::kSize; |
| 450 } | 452 } |
| 451 | 453 |
| 452 HValue* boilerplate_map = Add<HLoadNamedField>( | 454 HValue* boilerplate_map = Add<HLoadNamedField>( |
| 453 boilerplate, HObjectAccess::ForMap()); | 455 boilerplate, HObjectAccess::ForMap()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, | 495 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, |
| 494 JS_OBJECT_TYPE); | 496 JS_OBJECT_TYPE); |
| 495 | 497 |
| 496 // Store the map | 498 // Store the map |
| 497 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); | 499 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); |
| 498 AddStoreMapConstant(object, allocation_site_map); | 500 AddStoreMapConstant(object, allocation_site_map); |
| 499 | 501 |
| 500 // Store the payload (smi elements kind) | 502 // Store the payload (smi elements kind) |
| 501 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); | 503 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); |
| 502 Add<HStoreNamedField>(object, | 504 Add<HStoreNamedField>(object, |
| 503 HObjectAccess::ForAllocationSiteTransitionInfo(), | 505 HObjectAccess::ForAllocationSiteOffset( |
| 506 AllocationSite::kTransitionInfoOffset), |
| 504 initial_elements_kind); | 507 initial_elements_kind); |
| 505 | 508 |
| 506 // Unlike literals, constructed arrays don't have nested sites | 509 // Unlike literals, constructed arrays don't have nested sites |
| 507 Add<HStoreNamedField>(object, | 510 Add<HStoreNamedField>(object, |
| 508 HObjectAccess::ForAllocationSiteNestedSite(), | 511 HObjectAccess::ForAllocationSiteOffset( |
| 512 AllocationSite::kNestedSiteOffset), |
| 509 graph()->GetConstant0()); | 513 graph()->GetConstant0()); |
| 510 | 514 |
| 511 // Store an empty fixed array for the code dependency. | 515 // Store an empty fixed array for the code dependency. |
| 512 HConstant* empty_fixed_array = | 516 HConstant* empty_fixed_array = |
| 513 Add<HConstant>(isolate()->factory()->empty_fixed_array()); | 517 Add<HConstant>(isolate()->factory()->empty_fixed_array()); |
| 514 HStoreNamedField* store = Add<HStoreNamedField>( | 518 HStoreNamedField* store = Add<HStoreNamedField>( |
| 515 object, | 519 object, |
| 516 HObjectAccess::ForAllocationSiteDependentCode(), | 520 HObjectAccess::ForAllocationSiteOffset( |
| 521 AllocationSite::kDependentCodeOffset), |
| 517 empty_fixed_array); | 522 empty_fixed_array); |
| 518 | 523 |
| 519 // Link the object to the allocation site list | 524 // Link the object to the allocation site list |
| 520 HValue* site_list = Add<HConstant>( | 525 HValue* site_list = Add<HConstant>( |
| 521 ExternalReference::allocation_sites_list_address(isolate())); | 526 ExternalReference::allocation_sites_list_address(isolate())); |
| 522 HValue* site = Add<HLoadNamedField>(site_list, | 527 HValue* site = Add<HLoadNamedField>(site_list, |
| 523 HObjectAccess::ForAllocationSiteList()); | 528 HObjectAccess::ForAllocationSiteList()); |
| 524 store = Add<HStoreNamedField>(object, | 529 store = Add<HStoreNamedField>(object, |
| 525 HObjectAccess::ForAllocationSiteWeakNext(), | 530 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), |
| 526 site); | 531 site); |
| 527 store->SkipWriteBarrier(); | 532 store->SkipWriteBarrier(); |
| 528 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), | 533 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), |
| 529 object); | 534 object); |
| 530 | 535 |
| 531 // We use a hammer (SkipWriteBarrier()) to indicate that we know the input | 536 // We use a hammer (SkipWriteBarrier()) to indicate that we know the input |
| 532 // cell is really a Cell, and so no write barrier is needed. | 537 // cell is really a Cell, and so no write barrier is needed. |
| 533 // TODO(mvstanton): Add a debug_code check to verify the input cell is really | 538 // TODO(mvstanton): Add a debug_code check to verify the input cell is really |
| 534 // a cell. (perhaps with a new instruction, HAssert). | 539 // a cell. (perhaps with a new instruction, HAssert). |
| 535 HInstruction* cell = GetParameter(0); | 540 HInstruction* cell = GetParameter(0); |
| 536 HObjectAccess access = HObjectAccess::ForCellValue(); | 541 HObjectAccess access = HObjectAccess::ForCellValue(); |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 return js_function; | 1257 return js_function; |
| 1253 } | 1258 } |
| 1254 | 1259 |
| 1255 | 1260 |
| 1256 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1261 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
| 1257 return DoGenerateCode(isolate, this); | 1262 return DoGenerateCode(isolate, this); |
| 1258 } | 1263 } |
| 1259 | 1264 |
| 1260 | 1265 |
| 1261 } } // namespace v8::internal | 1266 } } // namespace v8::internal |
| OLD | NEW |