| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 427 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
| 428 HValue* boilerplate_size = | 428 HValue* boilerplate_size = |
| 429 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 429 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
| 430 HValue* size_in_words = | 430 HValue* size_in_words = |
| 431 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2)); | 431 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2)); |
| 432 checker.If<HCompareNumericAndBranch>(boilerplate_size, | 432 checker.If<HCompareNumericAndBranch>(boilerplate_size, |
| 433 size_in_words, Token::EQ); | 433 size_in_words, Token::EQ); |
| 434 checker.Then(); | 434 checker.Then(); |
| 435 | 435 |
| 436 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(size)); | 436 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(size)); |
| 437 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; | |
| 438 if (isolate()->heap()->ShouldGloballyPretenure()) { | |
| 439 flags = static_cast<HAllocate::Flags>( | |
| 440 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | |
| 441 } | |
| 442 | 437 |
| 443 HInstruction* object = AddInstruction(new(zone) | 438 HInstruction* object = AddInstruction(new(zone) |
| 444 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); | 439 HAllocate(context(), size_in_bytes, HType::JSObject(), |
| 440 isolate()->heap()->ShouldGloballyPretenure())); |
| 445 | 441 |
| 446 for (int i = 0; i < size; i += kPointerSize) { | 442 for (int i = 0; i < size; i += kPointerSize) { |
| 447 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); | 443 HObjectAccess access = HObjectAccess::ForJSObjectOffset(i); |
| 448 AddStore(object, access, AddLoad(boilerplate, access)); | 444 AddStore(object, access, AddLoad(boilerplate, access)); |
| 449 } | 445 } |
| 450 | 446 |
| 451 environment()->Push(object); | 447 environment()->Push(object); |
| 452 checker.ElseDeopt(); | 448 checker.ElseDeopt(); |
| 453 checker.End(); | 449 checker.End(); |
| 454 | 450 |
| 455 return environment()->Pop(); | 451 return environment()->Pop(); |
| 456 } | 452 } |
| 457 | 453 |
| 458 | 454 |
| 459 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { | 455 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { |
| 460 return DoGenerateCode(this); | 456 return DoGenerateCode(this); |
| 461 } | 457 } |
| 462 | 458 |
| 463 | 459 |
| 464 template <> | 460 template <> |
| 465 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 461 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { |
| 466 Zone* zone = this->zone(); | 462 Zone* zone = this->zone(); |
| 467 | 463 |
| 468 HValue* size = AddInstruction(new(zone) HConstant(AllocationSite::kSize)); | 464 HValue* size = AddInstruction(new(zone) HConstant(AllocationSite::kSize)); |
| 469 HAllocate::Flags flags = HAllocate::DefaultFlags(); | |
| 470 flags = static_cast<HAllocate::Flags>( | |
| 471 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | |
| 472 HInstruction* object = AddInstruction(new(zone) | 465 HInstruction* object = AddInstruction(new(zone) |
| 473 HAllocate(context(), size, HType::JSObject(), flags)); | 466 HAllocate(context(), size, HType::JSObject(), true)); |
| 474 | 467 |
| 475 // Store the map | 468 // Store the map |
| 476 Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(), | 469 Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(), |
| 477 isolate()); | 470 isolate()); |
| 478 AddStoreMapConstant(object, allocation_site_map); | 471 AddStoreMapConstant(object, allocation_site_map); |
| 479 | 472 |
| 480 // Store the payload (smi elements kind) | 473 // Store the payload (smi elements kind) |
| 481 HValue* initial_elements_kind = AddInstruction(new(zone) HConstant( | 474 HValue* initial_elements_kind = AddInstruction(new(zone) HConstant( |
| 482 GetInitialFastElementsKind())); | 475 GetInitialFastElementsKind())); |
| 483 Add<HStoreNamedField>(object, | 476 Add<HStoreNamedField>(object, |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 return value; | 945 return value; |
| 953 } | 946 } |
| 954 | 947 |
| 955 | 948 |
| 956 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 949 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { |
| 957 return DoGenerateCode(this); | 950 return DoGenerateCode(this); |
| 958 } | 951 } |
| 959 | 952 |
| 960 | 953 |
| 961 } } // namespace v8::internal | 954 } } // namespace v8::internal |
| OLD | NEW |