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

Side by Side Diff: regexp2000/src/heap.cc

Issue 11271: Building on regexp-ia32. (Closed)
Patch Set: Made it compile correctly. Created 12 years, 1 month 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 if (result->IsFailure()) return result; 1617 if (result->IsFailure()) return result;
1618 1618
1619 reinterpret_cast<Array*>(result)->set_map(byte_array_map()); 1619 reinterpret_cast<Array*>(result)->set_map(byte_array_map());
1620 reinterpret_cast<Array*>(result)->set_length(length); 1620 reinterpret_cast<Array*>(result)->set_length(length);
1621 return result; 1621 return result;
1622 } 1622 }
1623 1623
1624 1624
1625 Object* Heap::CreateCode(const CodeDesc& desc, 1625 Object* Heap::CreateCode(const CodeDesc& desc,
1626 ScopeInfo<>* sinfo, 1626 ScopeInfo<>* sinfo,
1627 Code::Flags flags) { 1627 Code::Flags flags,
1628 Handle<Code>* self) {
Erik Corry 2008/11/21 13:03:04 As discussed offline this should be passed by valu
Lasse Reichstein 2008/11/24 08:32:33 Done.
1628 // Compute size 1629 // Compute size
1629 int body_size = RoundUp(desc.instr_size + desc.reloc_size, kObjectAlignment); 1630 int body_size = RoundUp(desc.instr_size + desc.reloc_size, kObjectAlignment);
1630 int sinfo_size = 0; 1631 int sinfo_size = 0;
1631 if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL); 1632 if (sinfo != NULL) sinfo_size = sinfo->Serialize(NULL);
1632 int obj_size = Code::SizeFor(body_size, sinfo_size); 1633 int obj_size = Code::SizeFor(body_size, sinfo_size);
1633 Object* result; 1634 Object* result;
1634 if (obj_size > MaxHeapObjectSize()) { 1635 if (obj_size > MaxHeapObjectSize()) {
1635 result = lo_space_->AllocateRawCode(obj_size); 1636 result = lo_space_->AllocateRawCode(obj_size);
1636 } else { 1637 } else {
1637 result = code_space_->AllocateRaw(obj_size); 1638 result = code_space_->AllocateRaw(obj_size);
1638 } 1639 }
1639 1640
1640 if (result->IsFailure()) return result; 1641 if (result->IsFailure()) return result;
1641 1642
1642 // Initialize the object 1643 // Initialize the object
1643 HeapObject::cast(result)->set_map(code_map()); 1644 HeapObject::cast(result)->set_map(code_map());
1644 Code* code = Code::cast(result); 1645 Code* code = Code::cast(result);
1645 code->set_instruction_size(desc.instr_size); 1646 code->set_instruction_size(desc.instr_size);
1646 code->set_relocation_size(desc.reloc_size); 1647 code->set_relocation_size(desc.reloc_size);
1647 code->set_sinfo_size(sinfo_size); 1648 code->set_sinfo_size(sinfo_size);
1648 code->set_flags(flags); 1649 code->set_flags(flags);
1649 code->set_ic_flag(Code::IC_TARGET_IS_ADDRESS); 1650 code->set_ic_flag(Code::IC_TARGET_IS_ADDRESS);
1651 if (self != NULL) {
1652 // Allow self references to created code object.
1653 *(self->location()) = code;
1654 }
1650 code->CopyFrom(desc); // migrate generated code 1655 code->CopyFrom(desc); // migrate generated code
Erik Corry 2008/11/21 13:03:04 A comment here to the effect that CopyFrom may mak
Lasse Reichstein 2008/11/24 08:32:33 Done.
1651 if (sinfo != NULL) sinfo->Serialize(code); // write scope info 1656 if (sinfo != NULL) sinfo->Serialize(code); // write scope info
1652 1657
1653 #ifdef DEBUG 1658 #ifdef DEBUG
1654 code->Verify(); 1659 code->Verify();
1655 #endif 1660 #endif
1656 return code; 1661 return code;
1657 } 1662 }
1658 1663
1659 1664
1660 Object* Heap::CopyCode(Code* code) { 1665 Object* Heap::CopyCode(Code* code) {
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3339 #ifdef DEBUG 3344 #ifdef DEBUG
3340 bool Heap::GarbageCollectionGreedyCheck() { 3345 bool Heap::GarbageCollectionGreedyCheck() {
3341 ASSERT(FLAG_gc_greedy); 3346 ASSERT(FLAG_gc_greedy);
3342 if (Bootstrapper::IsActive()) return true; 3347 if (Bootstrapper::IsActive()) return true;
3343 if (disallow_allocation_failure()) return true; 3348 if (disallow_allocation_failure()) return true;
3344 return CollectGarbage(0, NEW_SPACE); 3349 return CollectGarbage(0, NEW_SPACE);
3345 } 3350 }
3346 #endif 3351 #endif
3347 3352
3348 } } // namespace v8::internal 3353 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698