| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 return environment()->Pop(); | 467 return environment()->Pop(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 | 470 |
| 471 Handle<Code> FastCloneShallowObjectStub::GenerateCode(Isolate* isolate) { | 471 Handle<Code> FastCloneShallowObjectStub::GenerateCode(Isolate* isolate) { |
| 472 return DoGenerateCode(isolate, this); | 472 return DoGenerateCode(isolate, this); |
| 473 } | 473 } |
| 474 | 474 |
| 475 | 475 |
| 476 template <> | 476 template <> |
| 477 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | |
| 478 HValue* size = Add<HConstant>(AllocationSite::kSize); | |
| 479 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, | |
| 480 JS_OBJECT_TYPE); | |
| 481 | |
| 482 // Store the map | |
| 483 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); | |
| 484 AddStoreMapConstant(object, allocation_site_map); | |
| 485 | |
| 486 // Store the payload (smi elements kind) | |
| 487 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); | |
| 488 Add<HStoreNamedField>(object, | |
| 489 HObjectAccess::ForAllocationSiteOffset( | |
| 490 AllocationSite::kTransitionInfoOffset), | |
| 491 initial_elements_kind); | |
| 492 | |
| 493 // Unlike literals, constructed arrays don't have nested sites | |
| 494 Add<HStoreNamedField>(object, | |
| 495 HObjectAccess::ForAllocationSiteOffset( | |
| 496 AllocationSite::kNestedSiteOffset), | |
| 497 graph()->GetConstant0()); | |
| 498 | |
| 499 // Pretenuring calculation field. | |
| 500 Add<HStoreNamedField>(object, | |
| 501 HObjectAccess::ForAllocationSiteOffset( | |
| 502 AllocationSite::kPretenureDataOffset), | |
| 503 graph()->GetConstant0()); | |
| 504 | |
| 505 // Pretenuring memento creation count field. | |
| 506 Add<HStoreNamedField>(object, | |
| 507 HObjectAccess::ForAllocationSiteOffset( | |
| 508 AllocationSite::kPretenureCreateCountOffset), | |
| 509 graph()->GetConstant0()); | |
| 510 | |
| 511 // Store an empty fixed array for the code dependency. | |
| 512 HConstant* empty_fixed_array = | |
| 513 Add<HConstant>(isolate()->factory()->empty_fixed_array()); | |
| 514 HStoreNamedField* store = Add<HStoreNamedField>( | |
| 515 object, | |
| 516 HObjectAccess::ForAllocationSiteOffset( | |
| 517 AllocationSite::kDependentCodeOffset), | |
| 518 empty_fixed_array); | |
| 519 | |
| 520 // Link the object to the allocation site list | |
| 521 HValue* site_list = Add<HConstant>( | |
| 522 ExternalReference::allocation_sites_list_address(isolate())); | |
| 523 HValue* site = Add<HLoadNamedField>( | |
| 524 site_list, static_cast<HValue*>(NULL), | |
| 525 HObjectAccess::ForAllocationSiteList()); | |
| 526 store = Add<HStoreNamedField>(object, | |
| 527 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), | |
| 528 site); | |
| 529 store->SkipWriteBarrier(); | |
| 530 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), | |
| 531 object); | |
| 532 | |
| 533 HInstruction* feedback_vector = GetParameter(0); | |
| 534 HInstruction* slot = GetParameter(1); | |
| 535 Add<HStoreKeyed>(feedback_vector, slot, object, FAST_ELEMENTS, | |
| 536 INITIALIZING_STORE); | |
| 537 return feedback_vector; | |
| 538 } | |
| 539 | |
| 540 | |
| 541 Handle<Code> CreateAllocationSiteStub::GenerateCode(Isolate* isolate) { | |
| 542 return DoGenerateCode(isolate, this); | |
| 543 } | |
| 544 | |
| 545 | |
| 546 template <> | |
| 547 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { | 477 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { |
| 548 HInstruction* load = BuildUncheckedMonomorphicElementAccess( | 478 HInstruction* load = BuildUncheckedMonomorphicElementAccess( |
| 549 GetParameter(0), GetParameter(1), NULL, | 479 GetParameter(0), GetParameter(1), NULL, |
| 550 casted_stub()->is_js_array(), casted_stub()->elements_kind(), | 480 casted_stub()->is_js_array(), casted_stub()->elements_kind(), |
| 551 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE); | 481 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE); |
| 552 return load; | 482 return load; |
| 553 } | 483 } |
| 554 | 484 |
| 555 | 485 |
| 556 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { | 486 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 return BuildRegExpConstructResult(length, index, input); | 1325 return BuildRegExpConstructResult(length, index, input); |
| 1396 } | 1326 } |
| 1397 | 1327 |
| 1398 | 1328 |
| 1399 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { | 1329 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { |
| 1400 return DoGenerateCode(isolate, this); | 1330 return DoGenerateCode(isolate, this); |
| 1401 } | 1331 } |
| 1402 | 1332 |
| 1403 | 1333 |
| 1404 } } // namespace v8::internal | 1334 } } // namespace v8::internal |
| OLD | NEW |