Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: src/interpreter/interpreter-assembler.cc

Issue 1923253002: [generators] Create the fixed array holding the registers only once. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter-assembler.cc
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc
index 9415a22c91a2cfdc9432f9e7b395909b73253749..db9b0cb3c0f3f557140524e373a31c0b651fd1d8 100644
--- a/src/interpreter/interpreter-assembler.cc
+++ b/src/interpreter/interpreter-assembler.cc
@@ -715,10 +715,12 @@ 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) {
+ if (FLAG_debug_code) {
+ Node* array_size = SmiUntag(LoadFixedArrayBaseLength(array));
+ AbortIfWordNotEqual(
+ array_size, RegisterCount(), kInvalidRegisterFileInGenerator);
+ }
Variable var_index(this, MachineRepresentation::kWord32);
var_index.Bind(Int32Constant(0));
@@ -729,16 +731,14 @@ 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 =
Int32Sub(Int32Constant(Register(0).ToOperand()), index);
Node* value = LoadRegister(ChangeInt32ToIntPtr(reg_index));
- // No write barrier needed for writing into freshly allocated object.
- StoreFixedArrayElementNoWriteBarrier(
- array, ChangeInt32ToIntPtr(index), value);
+ StoreFixedArrayElementInt32Index(array, index, value);
var_index.Bind(Int32Add(index, Int32Constant(1)));
Goto(&loop);
@@ -749,18 +749,23 @@ Node* InterpreterAssembler::ExportRegisterFile() {
}
Node* InterpreterAssembler::ImportRegisterFile(Node* array) {
- Node* register_count = RegisterCount();
+ if (FLAG_debug_code) {
+ Node* array_size = SmiUntag(LoadFixedArrayBaseLength(array));
+ AbortIfWordNotEqual(
+ array_size, RegisterCount(), kInvalidRegisterFileInGenerator);
+ }
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 +774,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);
}
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698