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

Unified Diff: src/deoptimizer.cc

Issue 1156393002: [deoptimizer] Materialize double values as smis whenever possible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index 76922085f0668d2c4fe1e06b89d875c4b99cc5ea..2a03c74c416e6aaedfdfee5bce9ff92d21d892b5 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -2269,6 +2269,9 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
case Translation::DOUBLE_REGISTER: {
int input_reg = iterator->Next();
double value = input_->GetDoubleRegister(input_reg);
+ int int_value = FastD2IChecked(value);
+ bool is_smi =
+ !IsMinusZero(value) && value == int_value && Smi::IsValid(int_value);
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
@@ -2278,7 +2281,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
"%e ; %s\n", value,
DoubleRegister::AllocationIndexToString(input_reg));
}
- AddObjectDoubleValue(value);
+ if (is_smi) {
+ intptr_t tagged_value =
+ reinterpret_cast<intptr_t>(Smi::FromInt(int_value));
+ AddObjectTaggedValue(tagged_value);
+ } else {
+ AddObjectDoubleValue(value);
+ }
return;
}
@@ -2380,6 +2389,9 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
int input_slot_index = iterator->Next();
unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
double value = input_->GetDoubleFrameSlot(input_offset);
+ int int_value = FastD2IChecked(value);
+ bool is_smi =
+ !IsMinusZero(value) && value == int_value && Smi::IsValid(int_value);
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
@@ -2388,7 +2400,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
PrintF(trace_scope_->file(),
"%e ; [sp + %d]\n", value, input_offset);
}
- AddObjectDoubleValue(value);
+ if (is_smi) {
+ intptr_t tagged_value =
+ reinterpret_cast<intptr_t>(Smi::FromInt(int_value));
+ AddObjectTaggedValue(tagged_value);
+ } else {
+ AddObjectDoubleValue(value);
+ }
return;
}
@@ -2586,18 +2604,25 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::DOUBLE_REGISTER: {
int input_reg = iterator->Next();
double value = input_->GetDoubleRegister(input_reg);
+ int int_value = FastD2IChecked(value);
+ bool is_smi =
+ !IsMinusZero(value) && value == int_value && Smi::IsValid(int_value);
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n",
- output_[frame_index]->GetTop() + output_offset,
- output_offset,
- value,
- DoubleRegister::AllocationIndexToString(input_reg));
+ output_[frame_index]->GetTop() + output_offset, output_offset,
+ value, DoubleRegister::AllocationIndexToString(input_reg));
+ }
+ if (is_smi) {
+ intptr_t tagged_value =
+ reinterpret_cast<intptr_t>(Smi::FromInt(int_value));
+ output_[frame_index]->SetFrameSlot(output_offset, tagged_value);
+ } else {
+ // We save the untagged value on the side and store a GC-safe
+ // temporary placeholder in the frame.
+ AddDoubleValue(output_[frame_index]->GetTop() + output_offset, value);
+ output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
}
- // We save the untagged value on the side and store a GC-safe
- // temporary placeholder in the frame.
- AddDoubleValue(output_[frame_index]->GetTop() + output_offset, value);
- output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
return;
}
@@ -2713,6 +2738,9 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
int input_slot_index = iterator->Next();
unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
double value = input_->GetDoubleFrameSlot(input_offset);
+ int int_value = FastD2IChecked(value);
+ bool is_smi =
+ !IsMinusZero(value) && value == int_value && Smi::IsValid(int_value);
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n",
@@ -2721,10 +2749,16 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
value,
input_offset);
}
- // We save the untagged value on the side and store a GC-safe
- // temporary placeholder in the frame.
- AddDoubleValue(output_[frame_index]->GetTop() + output_offset, value);
- output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
+ if (is_smi) {
+ intptr_t tagged_value =
+ reinterpret_cast<intptr_t>(Smi::FromInt(int_value));
+ output_[frame_index]->SetFrameSlot(output_offset, tagged_value);
+ } else {
+ // We save the untagged value on the side and store a GC-safe
+ // temporary placeholder in the frame.
+ AddDoubleValue(output_[frame_index]->GetTop() + output_offset, value);
+ output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
+ }
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698