Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index b65f085d3d70711ae4aad75ce9f1ec2bfd2198da..7365cf89a73074f64f4d8f33f4c7347a7fcf92d2 100644 |
--- a/src/code-stubs.h |
+++ b/src/code-stubs.h |
@@ -145,7 +145,9 @@ class CodeStub BASE_EMBEDDED { |
Handle<Code> GetCode(Isolate* isolate); |
// Retrieve the code for the stub, make and return a copy of the code. |
- Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate); |
+ Handle<Code> GetCodeCopy( |
+ Isolate* isolate, const Code::FindAndReplacePattern& pattern); |
+ |
static Major MajorKeyFromKey(uint32_t key) { |
return static_cast<Major>(MajorKeyBits::decode(key)); |
} |
@@ -999,18 +1001,19 @@ class StoreGlobalStub : public HandlerStub { |
} |
Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, |
- GlobalObject* global, |
- PropertyCell* cell) { |
- Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate); |
+ Handle<GlobalObject> global, |
+ Handle<PropertyCell> cell) { |
if (check_global()) { |
- // Replace the placeholder cell and global object map with the actual |
- // global cell and receiver map. |
- code->ReplaceNthObject(1, global_placeholder(isolate)->map(), global); |
- code->ReplaceNthObject(1, isolate->heap()->meta_map(), global->map()); |
+ Code::FindAndReplacePattern pattern; |
+ pattern.Add(Handle<Map>(global_placeholder(isolate)->map()), global); |
+ pattern.Add(isolate->factory()->meta_map(), Handle<Map>(global->map())); |
+ pattern.Add(isolate->factory()->global_property_cell_map(), cell); |
+ return CodeStub::GetCodeCopy(isolate, pattern); |
+ } else { |
+ Code::FindAndReplacePattern pattern; |
+ pattern.Add(isolate->factory()->global_property_cell_map(), cell); |
+ return CodeStub::GetCodeCopy(isolate, pattern); |
} |
- Map* cell_map = isolate->heap()->global_property_cell_map(); |
- code->ReplaceNthObject(1, cell_map, cell); |
- return code; |
} |
virtual Code::Kind kind() const { return Code::STORE_IC; } |
@@ -1195,10 +1198,9 @@ class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { |
Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, |
Handle<AllocationSite> allocation_site) { |
- Handle<Code> code = CodeStub::GetCodeCopyFromTemplate(isolate); |
- // Replace the placeholder oddball with the actual allocation site. |
- code->ReplaceNthObject(1, isolate->heap()->oddball_map(), *allocation_site); |
- return code; |
+ Code::FindAndReplacePattern pattern; |
+ pattern.Add(isolate->factory()->oddball_map(), allocation_site); |
+ return CodeStub::GetCodeCopy(isolate, pattern); |
} |
virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |