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