Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 586fd8613a5a4b9dcaa5b47bfa4d56e65d804c7b..ceadd4ed8b62776d355a0ea96f8efe2702cd444c 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -775,6 +775,7 @@ static i::Handle<i::FixedArray> EmbedderDataFor(Context* context, |
bool can_grow, |
const char* location) { |
i::Handle<i::Context> env = Utils::OpenHandle(context); |
+ i::Isolate* isolate = env->GetIsolate(); |
bool ok = |
Utils::ApiCheck(env->IsNativeContext(), |
location, |
@@ -787,7 +788,8 @@ static i::Handle<i::FixedArray> EmbedderDataFor(Context* context, |
return i::Handle<i::FixedArray>(); |
} |
int new_size = i::Max(index, data->length() << 1) + 1; |
- data = i::FixedArray::CopySize(data, new_size); |
+ int grow_by = new_size - data->length(); |
+ data = isolate->factory()->CopyFixedArrayAndGrow(data, grow_by); |
env->set_embedder_data(*data); |
return data; |
} |