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

Side by Side Diff: src/objects-inl.h

Issue 197283017: Refactor GetCodeCopyFromTemplate to get a single point where objects are replaced in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment Created 6 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4573 matching lines...) Expand 10 before | Expand all | Expand 10 after
4584 FLAG_weak_embedded_maps_in_optimized_code; 4584 FLAG_weak_embedded_maps_in_optimized_code;
4585 } 4585 }
4586 if (object->IsJSObject() || 4586 if (object->IsJSObject() ||
4587 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { 4587 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) {
4588 return FLAG_weak_embedded_objects_in_optimized_code; 4588 return FLAG_weak_embedded_objects_in_optimized_code;
4589 } 4589 }
4590 return false; 4590 return false;
4591 } 4591 }
4592 4592
4593 4593
4594 class Code::FindAndReplacePattern {
4595 public:
4596 FindAndReplacePattern() : count_(0) { }
4597 void Add(Handle<Map> map_to_find, Handle<Object> obj_to_replace) {
4598 ASSERT(count_ < kMaxCount);
4599 find_[count_] = map_to_find;
4600 replace_[count_] = obj_to_replace;
4601 ++count_;
4602 }
4603 private:
4604 static const int kMaxCount = 4;
4605 int count_;
4606 Handle<Map> find_[kMaxCount];
4607 Handle<Object> replace_[kMaxCount];
4608 friend class Code;
4609 };
4610
4611
4594 Object* Map::prototype() { 4612 Object* Map::prototype() {
4595 return READ_FIELD(this, kPrototypeOffset); 4613 return READ_FIELD(this, kPrototypeOffset);
4596 } 4614 }
4597 4615
4598 4616
4599 void Map::set_prototype(Object* value, WriteBarrierMode mode) { 4617 void Map::set_prototype(Object* value, WriteBarrierMode mode) {
4600 ASSERT(value->IsNull() || value->IsJSReceiver()); 4618 ASSERT(value->IsNull() || value->IsJSReceiver());
4601 WRITE_FIELD(this, kPrototypeOffset, value); 4619 WRITE_FIELD(this, kPrototypeOffset, value);
4602 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); 4620 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode);
4603 } 4621 }
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
6760 #undef READ_UINT32_FIELD 6778 #undef READ_UINT32_FIELD
6761 #undef WRITE_UINT32_FIELD 6779 #undef WRITE_UINT32_FIELD
6762 #undef READ_SHORT_FIELD 6780 #undef READ_SHORT_FIELD
6763 #undef WRITE_SHORT_FIELD 6781 #undef WRITE_SHORT_FIELD
6764 #undef READ_BYTE_FIELD 6782 #undef READ_BYTE_FIELD
6765 #undef WRITE_BYTE_FIELD 6783 #undef WRITE_BYTE_FIELD
6766 6784
6767 } } // namespace v8::internal 6785 } } // namespace v8::internal
6768 6786
6769 #endif // V8_OBJECTS_INL_H_ 6787 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698