Index: src/interpreter/interpreter-assembler.cc |
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
index 9415a22c91a2cfdc9432f9e7b395909b73253749..f41387daa26e04afdb3445f933de1a79e45fdf0d 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)); |
rmcilroy
2016/04/28 11:40:57
Maybe we could add if (FLAG_debug_code) which chec
neis
2016/04/28 11:47:21
Acknowledged. But why this flag rather than a DCHE
neis
2016/04/28 12:05:25
Nevermind, I got it.
|
@@ -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)); |
rmcilroy
2016/04/28 11:40:57
ditto
neis
2016/04/28 11:47:21
Acknowledged.
|
- // 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, StaleRegisterConstant()); |
+ |
var_index.Bind(Int32Add(index, Int32Constant(1))); |
Goto(&loop); |
} |