| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 // object to the callee and optionally the space to pass the argument | 1458 // object to the callee and optionally the space to pass the argument |
| 1459 // object to the stub failure handler. | 1459 // object to the stub failure handler. |
| 1460 ASSERT(descriptor->register_param_count_ >= 0); | 1460 ASSERT(descriptor->register_param_count_ >= 0); |
| 1461 int height_in_bytes = kPointerSize * descriptor->register_param_count_ + | 1461 int height_in_bytes = kPointerSize * descriptor->register_param_count_ + |
| 1462 sizeof(Arguments) + kPointerSize; | 1462 sizeof(Arguments) + kPointerSize; |
| 1463 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; | 1463 int fixed_frame_size = StandardFrameConstants::kFixedFrameSize; |
| 1464 int input_frame_size = input_->GetFrameSize(); | 1464 int input_frame_size = input_->GetFrameSize(); |
| 1465 int output_frame_size = height_in_bytes + fixed_frame_size; | 1465 int output_frame_size = height_in_bytes + fixed_frame_size; |
| 1466 if (trace_scope_ != NULL) { | 1466 if (trace_scope_ != NULL) { |
| 1467 PrintF(trace_scope_->file(), | 1467 PrintF(trace_scope_->file(), |
| 1468 " translating %s => StubFailureTrampolineStub, height=%d\n", | 1468 " translating %s => StubFailure%sTrampolineStub, height=%d\n", |
| 1469 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false), | 1469 CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false), |
| 1470 descriptor->HasTailCallContinuation() ? "TailCall" : "", |
| 1470 height_in_bytes); | 1471 height_in_bytes); |
| 1471 } | 1472 } |
| 1472 | 1473 |
| 1473 // The stub failure trampoline is a single frame. | 1474 // The stub failure trampoline is a single frame. |
| 1474 FrameDescription* output_frame = | 1475 FrameDescription* output_frame = |
| 1475 new(output_frame_size) FrameDescription(output_frame_size, NULL); | 1476 new(output_frame_size) FrameDescription(output_frame_size, NULL); |
| 1476 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); | 1477 output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 1477 ASSERT(frame_index == 0); | 1478 ASSERT(frame_index == 0); |
| 1478 output_[frame_index] = output_frame; | 1479 output_[frame_index] = output_frame; |
| 1479 | 1480 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 value = reinterpret_cast<intptr_t>( | 1532 value = reinterpret_cast<intptr_t>( |
| 1532 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); | 1533 Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE)); |
| 1533 output_frame->SetFrameSlot(output_frame_offset, value); | 1534 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1534 if (trace_scope_ != NULL) { | 1535 if (trace_scope_ != NULL) { |
| 1535 PrintF(trace_scope_->file(), | 1536 PrintF(trace_scope_->file(), |
| 1536 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1537 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 1537 V8PRIxPTR " ; function (stub failure sentinel)\n", | 1538 V8PRIxPTR " ; function (stub failure sentinel)\n", |
| 1538 top_address + output_frame_offset, output_frame_offset, value); | 1539 top_address + output_frame_offset, output_frame_offset, value); |
| 1539 } | 1540 } |
| 1540 | 1541 |
| 1541 intptr_t caller_arg_count = 0; | 1542 intptr_t caller_arg_count = descriptor->HasTailCallContinuation() |
| 1543 ? compiled_code_->arguments_count() + 1 : 0; |
| 1542 bool arg_count_known = !descriptor->stack_parameter_count_.is_valid(); | 1544 bool arg_count_known = !descriptor->stack_parameter_count_.is_valid(); |
| 1543 | 1545 |
| 1544 // Build the Arguments object for the caller's parameters and a pointer to it. | 1546 // Build the Arguments object for the caller's parameters and a pointer to it. |
| 1545 output_frame_offset -= kPointerSize; | 1547 output_frame_offset -= kPointerSize; |
| 1546 int args_arguments_offset = output_frame_offset; | 1548 int args_arguments_offset = output_frame_offset; |
| 1547 intptr_t the_hole = reinterpret_cast<intptr_t>( | 1549 intptr_t the_hole = reinterpret_cast<intptr_t>( |
| 1548 isolate_->heap()->the_hole_value()); | 1550 isolate_->heap()->the_hole_value()); |
| 1549 if (arg_count_known) { | 1551 if (arg_count_known) { |
| 1550 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + | 1552 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + |
| 1551 (caller_arg_count - 1) * kPointerSize; | 1553 (caller_arg_count - 1) * kPointerSize; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1579 (output_frame_size - output_frame_offset) + kPointerSize; | 1581 (output_frame_size - output_frame_offset) + kPointerSize; |
| 1580 output_frame->SetFrameSlot(output_frame_offset, value); | 1582 output_frame->SetFrameSlot(output_frame_offset, value); |
| 1581 if (trace_scope_ != NULL) { | 1583 if (trace_scope_ != NULL) { |
| 1582 PrintF(trace_scope_->file(), | 1584 PrintF(trace_scope_->file(), |
| 1583 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1585 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 1584 V8PRIxPTR " ; args*\n", | 1586 V8PRIxPTR " ; args*\n", |
| 1585 top_address + output_frame_offset, output_frame_offset, value); | 1587 top_address + output_frame_offset, output_frame_offset, value); |
| 1586 } | 1588 } |
| 1587 | 1589 |
| 1588 // Copy the register parameters to the failure frame. | 1590 // Copy the register parameters to the failure frame. |
| 1591 int arguments_length_offset = -1; |
| 1589 for (int i = 0; i < descriptor->register_param_count_; ++i) { | 1592 for (int i = 0; i < descriptor->register_param_count_; ++i) { |
| 1590 output_frame_offset -= kPointerSize; | 1593 output_frame_offset -= kPointerSize; |
| 1591 DoTranslateCommand(iterator, 0, output_frame_offset); | 1594 DoTranslateCommand(iterator, 0, output_frame_offset); |
| 1595 |
| 1596 if (!arg_count_known && descriptor->IsParameterCountRegister(i)) { |
| 1597 arguments_length_offset = output_frame_offset; |
| 1598 } |
| 1592 } | 1599 } |
| 1593 | 1600 |
| 1601 ASSERT(0 == output_frame_offset); |
| 1602 |
| 1594 if (!arg_count_known) { | 1603 if (!arg_count_known) { |
| 1595 DoTranslateCommand(iterator, 0, length_frame_offset, | 1604 ASSERT(arguments_length_offset >= 0); |
| 1596 TRANSLATED_VALUE_IS_NATIVE); | 1605 // We know it's a smi because 1) the code stub guarantees the stack |
| 1597 caller_arg_count = output_frame->GetFrameSlot(length_frame_offset); | 1606 // parameter count is in smi range, and 2) the DoTranslateCommand in the |
| 1607 // parameter loop above translated that to a tagged value. |
| 1608 Smi* smi_caller_arg_count = reinterpret_cast<Smi*>( |
| 1609 output_frame->GetFrameSlot(arguments_length_offset)); |
| 1610 caller_arg_count = smi_caller_arg_count->value(); |
| 1611 output_frame->SetFrameSlot(length_frame_offset, caller_arg_count); |
| 1612 if (trace_scope_ != NULL) { |
| 1613 PrintF(trace_scope_->file(), |
| 1614 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 1615 V8PRIxPTR " ; args.length\n", |
| 1616 top_address + length_frame_offset, length_frame_offset, |
| 1617 caller_arg_count); |
| 1618 } |
| 1598 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + | 1619 value = frame_ptr + StandardFrameConstants::kCallerSPOffset + |
| 1599 (caller_arg_count - 1) * kPointerSize; | 1620 (caller_arg_count - 1) * kPointerSize; |
| 1600 output_frame->SetFrameSlot(args_arguments_offset, value); | 1621 output_frame->SetFrameSlot(args_arguments_offset, value); |
| 1601 if (trace_scope_ != NULL) { | 1622 if (trace_scope_ != NULL) { |
| 1602 PrintF(trace_scope_->file(), | 1623 PrintF(trace_scope_->file(), |
| 1603 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 1624 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" |
| 1604 V8PRIxPTR " ; args.arguments\n", | 1625 V8PRIxPTR " ; args.arguments\n", |
| 1605 top_address + args_arguments_offset, args_arguments_offset, value); | 1626 top_address + args_arguments_offset, args_arguments_offset, |
| 1627 value); |
| 1606 } | 1628 } |
| 1607 } | 1629 } |
| 1608 | 1630 |
| 1609 ASSERT(0 == output_frame_offset); | |
| 1610 | |
| 1611 // Copy the double registers from the input into the output frame. | 1631 // Copy the double registers from the input into the output frame. |
| 1612 CopyDoubleRegisters(output_frame); | 1632 CopyDoubleRegisters(output_frame); |
| 1613 | 1633 |
| 1614 // Fill registers containing handler and number of parameters. | 1634 // Fill registers containing handler and number of parameters. |
| 1615 SetPlatformCompiledStubRegisters(output_frame, descriptor); | 1635 SetPlatformCompiledStubRegisters(output_frame, descriptor); |
| 1616 | 1636 |
| 1617 // Compute this frame's PC, state, and continuation. | 1637 // Compute this frame's PC, state, and continuation. |
| 1618 Code* trampoline = NULL; | 1638 Code* trampoline = NULL; |
| 1619 StubFunctionMode function_mode = descriptor->function_mode_; | 1639 if (descriptor->HasTailCallContinuation()) { |
| 1620 StubFailureTrampolineStub(function_mode).FindCodeInCache(&trampoline, | 1640 StubFailureTailCallTrampolineStub().FindCodeInCache(&trampoline, isolate_); |
| 1621 isolate_); | 1641 } else { |
| 1642 StubFunctionMode function_mode = descriptor->function_mode_; |
| 1643 StubFailureTrampolineStub(function_mode).FindCodeInCache(&trampoline, |
| 1644 isolate_); |
| 1645 } |
| 1622 ASSERT(trampoline != NULL); | 1646 ASSERT(trampoline != NULL); |
| 1623 output_frame->SetPc(reinterpret_cast<intptr_t>( | 1647 output_frame->SetPc(reinterpret_cast<intptr_t>( |
| 1624 trampoline->instruction_start())); | 1648 trampoline->instruction_start())); |
| 1625 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); | 1649 output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); |
| 1626 Code* notify_failure = | 1650 Code* notify_failure = |
| 1627 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure); | 1651 isolate_->builtins()->builtin(Builtins::kNotifyStubFailure); |
| 1628 output_frame->SetContinuation( | 1652 output_frame->SetContinuation( |
| 1629 reinterpret_cast<intptr_t>(notify_failure->entry())); | 1653 reinterpret_cast<intptr_t>(notify_failure->entry())); |
| 1630 } | 1654 } |
| 1631 | 1655 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 index); | 1891 index); |
| 1868 } | 1892 } |
| 1869 | 1893 |
| 1870 info->SetExpression(index, *num); | 1894 info->SetExpression(index, *num); |
| 1871 } | 1895 } |
| 1872 } | 1896 } |
| 1873 } | 1897 } |
| 1874 #endif | 1898 #endif |
| 1875 | 1899 |
| 1876 | 1900 |
| 1877 static const char* TraceValueType(bool is_smi, bool is_native = false) { | 1901 static const char* TraceValueType(bool is_smi) { |
| 1878 if (is_native) { | 1902 if (is_smi) { |
| 1879 return "native"; | |
| 1880 } else if (is_smi) { | |
| 1881 return "smi"; | 1903 return "smi"; |
| 1882 } | 1904 } |
| 1883 | 1905 |
| 1884 return "heap number"; | 1906 return "heap number"; |
| 1885 } | 1907 } |
| 1886 | 1908 |
| 1887 | 1909 |
| 1888 void Deoptimizer::DoTranslateObject(TranslationIterator* iterator, | 1910 void Deoptimizer::DoTranslateObject(TranslationIterator* iterator, |
| 1889 int object_index, | 1911 int object_index, |
| 1890 int field_index) { | 1912 int field_index) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 for (int i = 0; i < length; i++) { | 2161 for (int i = 0; i < length; i++) { |
| 2140 DoTranslateObject(iterator, object_index, i); | 2162 DoTranslateObject(iterator, object_index, i); |
| 2141 } | 2163 } |
| 2142 return; | 2164 return; |
| 2143 } | 2165 } |
| 2144 } | 2166 } |
| 2145 } | 2167 } |
| 2146 | 2168 |
| 2147 | 2169 |
| 2148 void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, | 2170 void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, |
| 2149 int frame_index, | 2171 int frame_index, |
| 2150 unsigned output_offset, | 2172 unsigned output_offset) { |
| 2151 DeoptimizerTranslatedValueType value_type) { | |
| 2152 disasm::NameConverter converter; | 2173 disasm::NameConverter converter; |
| 2153 // A GC-safe temporary placeholder that we can put in the output frame. | 2174 // A GC-safe temporary placeholder that we can put in the output frame. |
| 2154 const intptr_t kPlaceholder = reinterpret_cast<intptr_t>(Smi::FromInt(0)); | 2175 const intptr_t kPlaceholder = reinterpret_cast<intptr_t>(Smi::FromInt(0)); |
| 2155 bool is_native = value_type == TRANSLATED_VALUE_IS_NATIVE; | |
| 2156 | 2176 |
| 2157 Translation::Opcode opcode = | 2177 Translation::Opcode opcode = |
| 2158 static_cast<Translation::Opcode>(iterator->Next()); | 2178 static_cast<Translation::Opcode>(iterator->Next()); |
| 2159 | 2179 |
| 2160 switch (opcode) { | 2180 switch (opcode) { |
| 2161 case Translation::BEGIN: | 2181 case Translation::BEGIN: |
| 2162 case Translation::JS_FRAME: | 2182 case Translation::JS_FRAME: |
| 2163 case Translation::ARGUMENTS_ADAPTOR_FRAME: | 2183 case Translation::ARGUMENTS_ADAPTOR_FRAME: |
| 2164 case Translation::CONSTRUCT_STUB_FRAME: | 2184 case Translation::CONSTRUCT_STUB_FRAME: |
| 2165 case Translation::GETTER_STUB_FRAME: | 2185 case Translation::GETTER_STUB_FRAME: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2183 trace_scope_->file()); | 2203 trace_scope_->file()); |
| 2184 PrintF(trace_scope_->file(), "\n"); | 2204 PrintF(trace_scope_->file(), "\n"); |
| 2185 } | 2205 } |
| 2186 output_[frame_index]->SetFrameSlot(output_offset, input_value); | 2206 output_[frame_index]->SetFrameSlot(output_offset, input_value); |
| 2187 return; | 2207 return; |
| 2188 } | 2208 } |
| 2189 | 2209 |
| 2190 case Translation::INT32_REGISTER: { | 2210 case Translation::INT32_REGISTER: { |
| 2191 int input_reg = iterator->Next(); | 2211 int input_reg = iterator->Next(); |
| 2192 intptr_t value = input_->GetRegister(input_reg); | 2212 intptr_t value = input_->GetRegister(input_reg); |
| 2193 bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) && | 2213 bool is_smi = Smi::IsValid(value); |
| 2194 Smi::IsValid(value); | |
| 2195 if (trace_scope_ != NULL) { | 2214 if (trace_scope_ != NULL) { |
| 2196 PrintF( | 2215 PrintF( |
| 2197 trace_scope_->file(), | 2216 trace_scope_->file(), |
| 2198 " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIdPTR " ; %s (%s)\n", | 2217 " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIdPTR " ; %s (%s)\n", |
| 2199 output_[frame_index]->GetTop() + output_offset, | 2218 output_[frame_index]->GetTop() + output_offset, |
| 2200 output_offset, | 2219 output_offset, |
| 2201 value, | 2220 value, |
| 2202 converter.NameOfCPURegister(input_reg), | 2221 converter.NameOfCPURegister(input_reg), |
| 2203 TraceValueType(is_smi, is_native)); | 2222 TraceValueType(is_smi)); |
| 2204 } | 2223 } |
| 2205 if (is_smi) { | 2224 if (is_smi) { |
| 2206 intptr_t tagged_value = | 2225 intptr_t tagged_value = |
| 2207 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); | 2226 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); |
| 2208 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); | 2227 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); |
| 2209 } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) { | |
| 2210 output_[frame_index]->SetFrameSlot(output_offset, value); | |
| 2211 } else { | 2228 } else { |
| 2212 // We save the untagged value on the side and store a GC-safe | 2229 // We save the untagged value on the side and store a GC-safe |
| 2213 // temporary placeholder in the frame. | 2230 // temporary placeholder in the frame. |
| 2214 ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED); | |
| 2215 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, | 2231 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, |
| 2216 static_cast<double>(static_cast<int32_t>(value))); | 2232 static_cast<double>(static_cast<int32_t>(value))); |
| 2217 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); | 2233 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); |
| 2218 } | 2234 } |
| 2219 return; | 2235 return; |
| 2220 } | 2236 } |
| 2221 | 2237 |
| 2222 case Translation::UINT32_REGISTER: { | 2238 case Translation::UINT32_REGISTER: { |
| 2223 int input_reg = iterator->Next(); | 2239 int input_reg = iterator->Next(); |
| 2224 uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg)); | 2240 uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg)); |
| 2225 bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) && | 2241 bool is_smi = value <= static_cast<uintptr_t>(Smi::kMaxValue); |
| 2226 (value <= static_cast<uintptr_t>(Smi::kMaxValue)); | |
| 2227 if (trace_scope_ != NULL) { | 2242 if (trace_scope_ != NULL) { |
| 2228 PrintF( | 2243 PrintF( |
| 2229 trace_scope_->file(), | 2244 trace_scope_->file(), |
| 2230 " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIuPTR | 2245 " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIuPTR |
| 2231 " ; uint %s (%s)\n", | 2246 " ; uint %s (%s)\n", |
| 2232 output_[frame_index]->GetTop() + output_offset, | 2247 output_[frame_index]->GetTop() + output_offset, |
| 2233 output_offset, | 2248 output_offset, |
| 2234 value, | 2249 value, |
| 2235 converter.NameOfCPURegister(input_reg), | 2250 converter.NameOfCPURegister(input_reg), |
| 2236 TraceValueType(is_smi, is_native)); | 2251 TraceValueType(is_smi)); |
| 2237 } | 2252 } |
| 2238 if (is_smi) { | 2253 if (is_smi) { |
| 2239 intptr_t tagged_value = | 2254 intptr_t tagged_value = |
| 2240 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); | 2255 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); |
| 2241 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); | 2256 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); |
| 2242 } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) { | |
| 2243 output_[frame_index]->SetFrameSlot(output_offset, value); | |
| 2244 } else { | 2257 } else { |
| 2245 // We save the untagged value on the side and store a GC-safe | 2258 // We save the untagged value on the side and store a GC-safe |
| 2246 // temporary placeholder in the frame. | 2259 // temporary placeholder in the frame. |
| 2247 ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED); | |
| 2248 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, | 2260 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, |
| 2249 static_cast<double>(static_cast<uint32_t>(value))); | 2261 static_cast<double>(static_cast<uint32_t>(value))); |
| 2250 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); | 2262 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); |
| 2251 } | 2263 } |
| 2252 return; | 2264 return; |
| 2253 } | 2265 } |
| 2254 | 2266 |
| 2255 case Translation::DOUBLE_REGISTER: { | 2267 case Translation::DOUBLE_REGISTER: { |
| 2256 int input_reg = iterator->Next(); | 2268 int input_reg = iterator->Next(); |
| 2257 double value = input_->GetDoubleRegister(input_reg); | 2269 double value = input_->GetDoubleRegister(input_reg); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2288 PrintF(trace_scope_->file(), "\n"); | 2300 PrintF(trace_scope_->file(), "\n"); |
| 2289 } | 2301 } |
| 2290 output_[frame_index]->SetFrameSlot(output_offset, input_value); | 2302 output_[frame_index]->SetFrameSlot(output_offset, input_value); |
| 2291 return; | 2303 return; |
| 2292 } | 2304 } |
| 2293 | 2305 |
| 2294 case Translation::INT32_STACK_SLOT: { | 2306 case Translation::INT32_STACK_SLOT: { |
| 2295 int input_slot_index = iterator->Next(); | 2307 int input_slot_index = iterator->Next(); |
| 2296 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); | 2308 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); |
| 2297 intptr_t value = input_->GetFrameSlot(input_offset); | 2309 intptr_t value = input_->GetFrameSlot(input_offset); |
| 2298 bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) && | 2310 bool is_smi = Smi::IsValid(value); |
| 2299 Smi::IsValid(value); | |
| 2300 if (trace_scope_ != NULL) { | 2311 if (trace_scope_ != NULL) { |
| 2301 PrintF(trace_scope_->file(), | 2312 PrintF(trace_scope_->file(), |
| 2302 " 0x%08" V8PRIxPTR ": ", | 2313 " 0x%08" V8PRIxPTR ": ", |
| 2303 output_[frame_index]->GetTop() + output_offset); | 2314 output_[frame_index]->GetTop() + output_offset); |
| 2304 PrintF(trace_scope_->file(), | 2315 PrintF(trace_scope_->file(), |
| 2305 "[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n", | 2316 "[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n", |
| 2306 output_offset, | 2317 output_offset, |
| 2307 value, | 2318 value, |
| 2308 input_offset, | 2319 input_offset, |
| 2309 TraceValueType(is_smi, is_native)); | 2320 TraceValueType(is_smi)); |
| 2310 } | 2321 } |
| 2311 if (is_smi) { | 2322 if (is_smi) { |
| 2312 intptr_t tagged_value = | 2323 intptr_t tagged_value = |
| 2313 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); | 2324 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); |
| 2314 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); | 2325 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); |
| 2315 } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) { | |
| 2316 output_[frame_index]->SetFrameSlot(output_offset, value); | |
| 2317 } else { | 2326 } else { |
| 2318 // We save the untagged value on the side and store a GC-safe | 2327 // We save the untagged value on the side and store a GC-safe |
| 2319 // temporary placeholder in the frame. | 2328 // temporary placeholder in the frame. |
| 2320 ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED); | |
| 2321 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, | 2329 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, |
| 2322 static_cast<double>(static_cast<int32_t>(value))); | 2330 static_cast<double>(static_cast<int32_t>(value))); |
| 2323 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); | 2331 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); |
| 2324 } | 2332 } |
| 2325 return; | 2333 return; |
| 2326 } | 2334 } |
| 2327 | 2335 |
| 2328 case Translation::UINT32_STACK_SLOT: { | 2336 case Translation::UINT32_STACK_SLOT: { |
| 2329 int input_slot_index = iterator->Next(); | 2337 int input_slot_index = iterator->Next(); |
| 2330 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); | 2338 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); |
| 2331 uintptr_t value = | 2339 uintptr_t value = |
| 2332 static_cast<uintptr_t>(input_->GetFrameSlot(input_offset)); | 2340 static_cast<uintptr_t>(input_->GetFrameSlot(input_offset)); |
| 2333 bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) && | 2341 bool is_smi = value <= static_cast<uintptr_t>(Smi::kMaxValue); |
| 2334 (value <= static_cast<uintptr_t>(Smi::kMaxValue)); | |
| 2335 if (trace_scope_ != NULL) { | 2342 if (trace_scope_ != NULL) { |
| 2336 PrintF(trace_scope_->file(), | 2343 PrintF(trace_scope_->file(), |
| 2337 " 0x%08" V8PRIxPTR ": ", | 2344 " 0x%08" V8PRIxPTR ": ", |
| 2338 output_[frame_index]->GetTop() + output_offset); | 2345 output_[frame_index]->GetTop() + output_offset); |
| 2339 PrintF(trace_scope_->file(), | 2346 PrintF(trace_scope_->file(), |
| 2340 "[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n", | 2347 "[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n", |
| 2341 output_offset, | 2348 output_offset, |
| 2342 value, | 2349 value, |
| 2343 input_offset, | 2350 input_offset, |
| 2344 TraceValueType(is_smi, is_native)); | 2351 TraceValueType(is_smi)); |
| 2345 } | 2352 } |
| 2346 if (is_smi) { | 2353 if (is_smi) { |
| 2347 intptr_t tagged_value = | 2354 intptr_t tagged_value = |
| 2348 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); | 2355 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); |
| 2349 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); | 2356 output_[frame_index]->SetFrameSlot(output_offset, tagged_value); |
| 2350 } else if (value_type == TRANSLATED_VALUE_IS_NATIVE) { | |
| 2351 output_[frame_index]->SetFrameSlot(output_offset, value); | |
| 2352 } else { | 2357 } else { |
| 2353 // We save the untagged value on the side and store a GC-safe | 2358 // We save the untagged value on the side and store a GC-safe |
| 2354 // temporary placeholder in the frame. | 2359 // temporary placeholder in the frame. |
| 2355 ASSERT(value_type == TRANSLATED_VALUE_IS_TAGGED); | |
| 2356 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, | 2360 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, |
| 2357 static_cast<double>(static_cast<uint32_t>(value))); | 2361 static_cast<double>(static_cast<uint32_t>(value))); |
| 2358 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); | 2362 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); |
| 2359 } | 2363 } |
| 2360 return; | 2364 return; |
| 2361 } | 2365 } |
| 2362 | 2366 |
| 2363 case Translation::DOUBLE_STACK_SLOT: { | 2367 case Translation::DOUBLE_STACK_SLOT: { |
| 2364 int input_slot_index = iterator->Next(); | 2368 int input_slot_index = iterator->Next(); |
| 2365 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); | 2369 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3051 | 3055 |
| 3052 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3056 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 3053 v->VisitPointer(BitCast<Object**>(&function_)); | 3057 v->VisitPointer(BitCast<Object**>(&function_)); |
| 3054 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3058 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 3055 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3059 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 3056 } | 3060 } |
| 3057 | 3061 |
| 3058 #endif // ENABLE_DEBUGGER_SUPPORT | 3062 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3059 | 3063 |
| 3060 } } // namespace v8::internal | 3064 } } // namespace v8::internal |
| OLD | NEW |