Chromium Code Reviews| Index: src/interpreter/interpreter-assembler.cc |
| diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
| index 9415a22c91a2cfdc9432f9e7b395909b73253749..9bcdbd48b4750cae624f6cb50e684dad948f67c2 100644 |
| --- a/src/interpreter/interpreter-assembler.cc |
| +++ b/src/interpreter/interpreter-assembler.cc |
| @@ -715,11 +715,7 @@ Node* InterpreterAssembler::RegisterCount() { |
| return Word32Sar(frame_size, Int32Constant(kPointerSizeLog2)); |
| } |
| -Node* InterpreterAssembler::ExportRegisterFile() { |
| - Node* register_count = RegisterCount(); |
| - Node* array = |
| - AllocateUninitializedFixedArray(ChangeInt32ToIntPtr(register_count)); |
| - |
| +Node* InterpreterAssembler::ExportRegisterFile(Node* array) { |
| Variable var_index(this, MachineRepresentation::kWord32); |
| var_index.Bind(Int32Constant(0)); |
| @@ -729,7 +725,7 @@ Node* InterpreterAssembler::ExportRegisterFile() { |
| Bind(&loop); |
| { |
| Node* index = var_index.value(); |
| - Node* condition = Int32LessThan(index, register_count); |
| + Node* condition = Int32LessThan(index, RegisterCount()); |
| GotoUnless(condition, &done_loop); |
| Node* reg_index = |
| @@ -749,18 +745,17 @@ Node* InterpreterAssembler::ExportRegisterFile() { |
| } |
| Node* InterpreterAssembler::ImportRegisterFile(Node* array) { |
| - Node* register_count = RegisterCount(); |
| - |
| Variable var_index(this, MachineRepresentation::kWord32); |
| var_index.Bind(Int32Constant(0)); |
| - // Iterate over array and write values into register file. |
| + // Iterate over array and write values into register file. Also erase the |
| + // array contents to not keep them alive artificially. |
| Label loop(this, &var_index), done_loop(this); |
| Goto(&loop); |
| Bind(&loop); |
| { |
| Node* index = var_index.value(); |
| - Node* condition = Int32LessThan(index, register_count); |
| + Node* condition = Int32LessThan(index, RegisterCount()); |
| GotoUnless(condition, &done_loop); |
| Node* value = LoadFixedArrayElementInt32Index(array, index); |
| @@ -769,6 +764,8 @@ Node* InterpreterAssembler::ImportRegisterFile(Node* array) { |
| Int32Sub(Int32Constant(Register(0).ToOperand()), index); |
| StoreRegister(value, ChangeInt32ToIntPtr(reg_index)); |
| + StoreFixedArrayElementInt32Index(array, index, PlaceholderConstant()); |
|
rmcilroy
2016/04/27 12:20:04
How about just filling the array with the hole or
Benedikt Meurer
2016/04/27 17:46:02
undefined is a valid JS value, so a bug in reading
rmcilroy
2016/04/28 08:05:49
Makes sense, SGTM with the rename you suggest.
|
| + |
| var_index.Bind(Int32Add(index, Int32Constant(1))); |
| Goto(&loop); |
| } |