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

Unified Diff: src/deoptimizer.cc

Issue 70203002: Simplify Hydrogen code stubs with variable argument count (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 7 years, 1 month 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/deoptimizer.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | 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 4f2cd03c04edc364c06b66ffe1273dac6e71ac2b..ef4e39e8c2b1e143adeea7f8687cb0392ab5791b 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -1586,15 +1586,34 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
}
// Copy the register parameters to the failure frame.
+ int arguments_length_offset = -1;
for (int i = 0; i < descriptor->register_param_count_; ++i) {
output_frame_offset -= kPointerSize;
DoTranslateCommand(iterator, 0, output_frame_offset);
+
+ if (!arg_count_known && descriptor->IsParameterCountRegister(i)) {
+ arguments_length_offset = output_frame_offset;
+ }
}
+ ASSERT(0 == output_frame_offset);
+
if (!arg_count_known) {
- DoTranslateCommand(iterator, 0, length_frame_offset,
- TRANSLATED_VALUE_IS_NATIVE);
- caller_arg_count = output_frame->GetFrameSlot(length_frame_offset);
+ ASSERT(arguments_length_offset >= 0);
+ // We know it's a smi because 1) the code stub guarantees the stack
+ // parameter count is in smi range, and 2) the DoTranslateCommand in the
+ // parameter loop above translated that to a tagged value.
+ Smi* smi_caller_arg_count = reinterpret_cast<Smi*>(
+ output_frame->GetFrameSlot(arguments_length_offset));
+ caller_arg_count = smi_caller_arg_count->value();
+ output_frame->SetFrameSlot(length_frame_offset, caller_arg_count);
+ if (trace_scope_ != NULL) {
+ PrintF(trace_scope_->file(),
+ " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
+ V8PRIxPTR " ; args.length\n",
+ top_address + length_frame_offset, length_frame_offset,
+ caller_arg_count);
+ }
value = frame_ptr + StandardFrameConstants::kCallerSPOffset +
(caller_arg_count - 1) * kPointerSize;
output_frame->SetFrameSlot(args_arguments_offset, value);
@@ -1602,12 +1621,11 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
PrintF(trace_scope_->file(),
" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
V8PRIxPTR " ; args.arguments\n",
- top_address + args_arguments_offset, args_arguments_offset, value);
+ top_address + args_arguments_offset, args_arguments_offset,
+ value);
}
}
- ASSERT(0 == output_frame_offset);
-
// Copy the double registers from the input into the output frame.
CopyDoubleRegisters(output_frame);
@@ -1874,10 +1892,8 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame(
#endif
-static const char* TraceValueType(bool is_smi, bool is_native = false) {
- if (is_native) {
- return "native";
- } else if (is_smi) {
+static const char* TraceValueType(bool is_smi) {
+ if (is_smi) {
return "smi";
}
@@ -2146,13 +2162,11 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
- int frame_index,
- unsigned output_offset,
- DeoptimizerTranslatedValueType value_type) {
+ int frame_index,
+ unsigned output_offset) {
disasm::NameConverter converter;
// A GC-safe temporary placeholder that we can put in the output frame.
const intptr_t kPlaceholder = reinterpret_cast<intptr_t>(Smi::FromInt(0));
- bool is_native = value_type == TRANSLATED_VALUE_IS_NATIVE;
Translation::Opcode opcode =
static_cast<Translation::Opcode>(iterator->Next());
@@ -2190,8 +2204,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::INT32_REGISTER: {
int input_reg = iterator->Next();
intptr_t value = input_->GetRegister(input_reg);
- bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
- Smi::IsValid(value);
+ bool is_smi = Smi::IsValid(value);
if (trace_scope_ != NULL) {
PrintF(
trace_scope_->file(),
@@ -2200,18 +2213,15 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
output_offset,
value,
converter.NameOfCPURegister(input_reg),
- TraceValueType(is_smi, is_native));
+ TraceValueType(is_smi));
}
if (is_smi) {
intptr_t tagged_value =
reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value)));
output_[frame_index]->SetFrameSlot(output_offset, tagged_value);
- } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) {
- output_[frame_index]->SetFrameSlot(output_offset, value);
} else {
// We save the untagged value on the side and store a GC-safe
// temporary placeholder in the frame.
- ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED);
AddDoubleValue(output_[frame_index]->GetTop() + output_offset,
static_cast<double>(static_cast<int32_t>(value)));
output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
@@ -2222,8 +2232,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::UINT32_REGISTER: {
int input_reg = iterator->Next();
uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg));
- bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
- (value <= static_cast<uintptr_t>(Smi::kMaxValue));
+ bool is_smi = value <= static_cast<uintptr_t>(Smi::kMaxValue);
if (trace_scope_ != NULL) {
PrintF(
trace_scope_->file(),
@@ -2233,18 +2242,15 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
output_offset,
value,
converter.NameOfCPURegister(input_reg),
- TraceValueType(is_smi, is_native));
+ TraceValueType(is_smi));
}
if (is_smi) {
intptr_t tagged_value =
reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value)));
output_[frame_index]->SetFrameSlot(output_offset, tagged_value);
- } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) {
- output_[frame_index]->SetFrameSlot(output_offset, value);
} else {
// We save the untagged value on the side and store a GC-safe
// temporary placeholder in the frame.
- ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED);
AddDoubleValue(output_[frame_index]->GetTop() + output_offset,
static_cast<double>(static_cast<uint32_t>(value)));
output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
@@ -2295,8 +2301,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
int input_slot_index = iterator->Next();
unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
intptr_t value = input_->GetFrameSlot(input_offset);
- bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
- Smi::IsValid(value);
+ bool is_smi = Smi::IsValid(value);
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" 0x%08" V8PRIxPTR ": ",
@@ -2306,18 +2311,15 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
output_offset,
value,
input_offset,
- TraceValueType(is_smi, is_native));
+ TraceValueType(is_smi));
}
if (is_smi) {
intptr_t tagged_value =
reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value)));
output_[frame_index]->SetFrameSlot(output_offset, tagged_value);
- } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) {
- output_[frame_index]->SetFrameSlot(output_offset, value);
} else {
// We save the untagged value on the side and store a GC-safe
// temporary placeholder in the frame.
- ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED);
AddDoubleValue(output_[frame_index]->GetTop() + output_offset,
static_cast<double>(static_cast<int32_t>(value)));
output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
@@ -2330,8 +2332,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
uintptr_t value =
static_cast<uintptr_t>(input_->GetFrameSlot(input_offset));
- bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
- (value <= static_cast<uintptr_t>(Smi::kMaxValue));
+ bool is_smi = value <= static_cast<uintptr_t>(Smi::kMaxValue);
if (trace_scope_ != NULL) {
PrintF(trace_scope_->file(),
" 0x%08" V8PRIxPTR ": ",
@@ -2341,18 +2342,15 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
output_offset,
value,
input_offset,
- TraceValueType(is_smi, is_native));
+ TraceValueType(is_smi));
}
if (is_smi) {
intptr_t tagged_value =
reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value)));
output_[frame_index]->SetFrameSlot(output_offset, tagged_value);
- } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) {
- output_[frame_index]->SetFrameSlot(output_offset, value);
} else {
// We save the untagged value on the side and store a GC-safe
// temporary placeholder in the frame.
- ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED);
AddDoubleValue(output_[frame_index]->GetTop() + output_offset,
static_cast<double>(static_cast<uint32_t>(value)));
output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
« no previous file with comments | « src/deoptimizer.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698