| Index: src/heap/heap.cc | 
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc | 
| index 2ac5146c46d0cf06c6f00f2bbea878a0015db66b..25e4acd0e4f5f4b5bb4698f55e29d8160390f2ff 100644 | 
| --- a/src/heap/heap.cc | 
| +++ b/src/heap/heap.cc | 
| @@ -3708,14 +3708,17 @@ AllocationResult Heap::AllocateCode(int object_size, bool immovable) { | 
| AllocationResult Heap::CopyCode(Code* code) { | 
| AllocationResult allocation; | 
| HeapObject* new_constant_pool; | 
| -  if (FLAG_enable_ool_constant_pool && | 
| -      code->constant_pool() != empty_constant_pool_array()) { | 
| -    // Copy the constant pool, since edits to the copied code may modify | 
| -    // the constant pool. | 
| -    allocation = CopyConstantPoolArray(code->constant_pool()); | 
| -    if (!allocation.To(&new_constant_pool)) return allocation; | 
| -  } else { | 
| -    new_constant_pool = empty_constant_pool_array(); | 
| +  if (FLAG_enable_ool_constant_pool) { | 
| +    ConstantPoolArray* constant_pool = | 
| +        reinterpret_cast<ConstantPoolArray*>(code->constant_pool()); | 
| +    if (constant_pool != empty_constant_pool_array()) { | 
| +      // Copy the constant pool, since edits to the copied code may modify | 
| +      // the constant pool. | 
| +      allocation = CopyConstantPoolArray(constant_pool); | 
| +      if (!allocation.To(&new_constant_pool)) return allocation; | 
| +    } else { | 
| +      new_constant_pool = empty_constant_pool_array(); | 
| +    } | 
| } | 
|  | 
| HeapObject* result; | 
| @@ -3730,8 +3733,10 @@ AllocationResult Heap::CopyCode(Code* code) { | 
| CopyBlock(new_addr, old_addr, obj_size); | 
| Code* new_code = Code::cast(result); | 
|  | 
| -  // Update the constant pool. | 
| -  new_code->set_constant_pool(new_constant_pool); | 
| +  if (FLAG_enable_ool_constant_pool) { | 
| +    // Update the constant pool. | 
| +    new_code->set_constant_pool(new_constant_pool); | 
| +  } | 
|  | 
| // Relocate the copy. | 
| DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || | 
| @@ -3751,14 +3756,17 @@ AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { | 
| if (!allocation.To(&reloc_info_array)) return allocation; | 
| } | 
| HeapObject* new_constant_pool; | 
| -  if (FLAG_enable_ool_constant_pool && | 
| -      code->constant_pool() != empty_constant_pool_array()) { | 
| -    // Copy the constant pool, since edits to the copied code may modify | 
| -    // the constant pool. | 
| -    AllocationResult allocation = CopyConstantPoolArray(code->constant_pool()); | 
| -    if (!allocation.To(&new_constant_pool)) return allocation; | 
| -  } else { | 
| -    new_constant_pool = empty_constant_pool_array(); | 
| +  if (FLAG_enable_ool_constant_pool) { | 
| +    ConstantPoolArray* constant_pool = | 
| +        reinterpret_cast<ConstantPoolArray*>(code->constant_pool()); | 
| +    if (constant_pool != empty_constant_pool_array()) { | 
| +      // Copy the constant pool, since edits to the copied code may modify | 
| +      // the constant pool. | 
| +      AllocationResult allocation = CopyConstantPoolArray(constant_pool); | 
| +      if (!allocation.To(&new_constant_pool)) return allocation; | 
| +    } else { | 
| +      new_constant_pool = empty_constant_pool_array(); | 
| +    } | 
| } | 
|  | 
| int new_body_size = RoundUp(code->instruction_size(), kObjectAlignment); | 
| @@ -3784,8 +3792,10 @@ AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { | 
| Code* new_code = Code::cast(result); | 
| new_code->set_relocation_info(reloc_info_array); | 
|  | 
| -  // Update constant pool. | 
| -  new_code->set_constant_pool(new_constant_pool); | 
| +  if (FLAG_enable_ool_constant_pool) { | 
| +    // Update constant pool. | 
| +    new_code->set_constant_pool(new_constant_pool); | 
| +  } | 
|  | 
| // Copy patched rinfo. | 
| CopyBytes(new_code->relocation_start(), reloc_info.start(), | 
|  |