| 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 1959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 ? input_->GetFrameSlot(input_offset) | 1970 ? input_->GetFrameSlot(input_offset) |
| 1971 : reinterpret_cast<intptr_t>(isolate_->heap()->the_hole_value()); | 1971 : reinterpret_cast<intptr_t>(isolate_->heap()->the_hole_value()); |
| 1972 AddArgumentsObjectValue(input_value); | 1972 AddArgumentsObjectValue(input_value); |
| 1973 } | 1973 } |
| 1974 return; | 1974 return; |
| 1975 } | 1975 } |
| 1976 } | 1976 } |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 | 1979 |
| 1980 static bool ObjectToInt32(Object* obj, int32_t* value) { | |
| 1981 if (obj->IsSmi()) { | |
| 1982 *value = Smi::cast(obj)->value(); | |
| 1983 return true; | |
| 1984 } | |
| 1985 | |
| 1986 if (obj->IsHeapNumber()) { | |
| 1987 double num = HeapNumber::cast(obj)->value(); | |
| 1988 if (FastI2D(FastD2I(num)) != num) { | |
| 1989 if (FLAG_trace_osr) { | |
| 1990 PrintF("**** %g could not be converted to int32 ****\n", | |
| 1991 HeapNumber::cast(obj)->value()); | |
| 1992 } | |
| 1993 return false; | |
| 1994 } | |
| 1995 | |
| 1996 *value = FastD2I(num); | |
| 1997 return true; | |
| 1998 } | |
| 1999 | |
| 2000 return false; | |
| 2001 } | |
| 2002 | |
| 2003 | |
| 2004 static bool ObjectToUint32(Object* obj, uint32_t* value) { | |
| 2005 if (obj->IsSmi()) { | |
| 2006 if (Smi::cast(obj)->value() < 0) return false; | |
| 2007 | |
| 2008 *value = static_cast<uint32_t>(Smi::cast(obj)->value()); | |
| 2009 return true; | |
| 2010 } | |
| 2011 | |
| 2012 if (obj->IsHeapNumber()) { | |
| 2013 double num = HeapNumber::cast(obj)->value(); | |
| 2014 if ((num < 0) || (FastUI2D(FastD2UI(num)) != num)) { | |
| 2015 if (FLAG_trace_osr) { | |
| 2016 PrintF("**** %g could not be converted to uint32 ****\n", | |
| 2017 HeapNumber::cast(obj)->value()); | |
| 2018 } | |
| 2019 return false; | |
| 2020 } | |
| 2021 | |
| 2022 *value = FastD2UI(num); | |
| 2023 return true; | |
| 2024 } | |
| 2025 | |
| 2026 return false; | |
| 2027 } | |
| 2028 | |
| 2029 | |
| 2030 bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, | 1980 bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, |
| 2031 int* input_offset) { | 1981 int* input_offset) { |
| 2032 disasm::NameConverter converter; | 1982 disasm::NameConverter converter; |
| 2033 FrameDescription* output = output_[0]; | 1983 FrameDescription* output = output_[0]; |
| 2034 | 1984 |
| 2035 // The input values are all part of the unoptimized frame so they | 1985 // The input values are all part of the unoptimized frame so they |
| 2036 // are all tagged pointers. | 1986 // are all tagged pointers. |
| 2037 uintptr_t input_value = input_->GetFrameSlot(*input_offset); | 1987 uintptr_t input_value = input_->GetFrameSlot(*input_offset); |
| 2038 Object* input_object = reinterpret_cast<Object*>(input_value); | 1988 Object* input_object = reinterpret_cast<Object*>(input_value); |
| 2039 | 1989 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2063 converter.NameOfCPURegister(output_reg), | 2013 converter.NameOfCPURegister(output_reg), |
| 2064 input_value, | 2014 input_value, |
| 2065 *input_offset); | 2015 *input_offset); |
| 2066 } | 2016 } |
| 2067 output->SetRegister(output_reg, input_value); | 2017 output->SetRegister(output_reg, input_value); |
| 2068 break; | 2018 break; |
| 2069 } | 2019 } |
| 2070 | 2020 |
| 2071 case Translation::INT32_REGISTER: { | 2021 case Translation::INT32_REGISTER: { |
| 2072 int32_t int32_value = 0; | 2022 int32_t int32_value = 0; |
| 2073 if (!ObjectToInt32(input_object, &int32_value)) return false; | 2023 if (!input_object->ToInt32(&int32_value)) return false; |
| 2074 | 2024 |
| 2075 int output_reg = iterator->Next(); | 2025 int output_reg = iterator->Next(); |
| 2076 if (FLAG_trace_osr) { | 2026 if (FLAG_trace_osr) { |
| 2077 PrintF(" %s <- %d (int32) ; [sp + %d]\n", | 2027 PrintF(" %s <- %d (int32) ; [sp + %d]\n", |
| 2078 converter.NameOfCPURegister(output_reg), | 2028 converter.NameOfCPURegister(output_reg), |
| 2079 int32_value, | 2029 int32_value, |
| 2080 *input_offset); | 2030 *input_offset); |
| 2081 } | 2031 } |
| 2082 output->SetRegister(output_reg, int32_value); | 2032 output->SetRegister(output_reg, int32_value); |
| 2083 break; | 2033 break; |
| 2084 } | 2034 } |
| 2085 | 2035 |
| 2086 case Translation::UINT32_REGISTER: { | 2036 case Translation::UINT32_REGISTER: { |
| 2087 uint32_t uint32_value = 0; | 2037 uint32_t uint32_value = 0; |
| 2088 if (!ObjectToUint32(input_object, &uint32_value)) return false; | 2038 if (!input_object->ToUint32(&uint32_value)) return false; |
| 2089 | 2039 |
| 2090 int output_reg = iterator->Next(); | 2040 int output_reg = iterator->Next(); |
| 2091 if (FLAG_trace_osr) { | 2041 if (FLAG_trace_osr) { |
| 2092 PrintF(" %s <- %u (uint32) ; [sp + %d]\n", | 2042 PrintF(" %s <- %u (uint32) ; [sp + %d]\n", |
| 2093 converter.NameOfCPURegister(output_reg), | 2043 converter.NameOfCPURegister(output_reg), |
| 2094 uint32_value, | 2044 uint32_value, |
| 2095 *input_offset); | 2045 *input_offset); |
| 2096 } | 2046 } |
| 2097 output->SetRegister(output_reg, static_cast<int32_t>(uint32_value)); | 2047 output->SetRegister(output_reg, static_cast<int32_t>(uint32_value)); |
| 2098 } | 2048 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2125 *input_offset); | 2075 *input_offset); |
| 2126 reinterpret_cast<Object*>(input_value)->ShortPrint(); | 2076 reinterpret_cast<Object*>(input_value)->ShortPrint(); |
| 2127 PrintF("\n"); | 2077 PrintF("\n"); |
| 2128 } | 2078 } |
| 2129 output->SetFrameSlot(output_offset, input_value); | 2079 output->SetFrameSlot(output_offset, input_value); |
| 2130 break; | 2080 break; |
| 2131 } | 2081 } |
| 2132 | 2082 |
| 2133 case Translation::INT32_STACK_SLOT: { | 2083 case Translation::INT32_STACK_SLOT: { |
| 2134 int32_t int32_value = 0; | 2084 int32_t int32_value = 0; |
| 2135 if (!ObjectToInt32(input_object, &int32_value)) return false; | 2085 if (!input_object->ToInt32(&int32_value)) return false; |
| 2136 | 2086 |
| 2137 int output_index = iterator->Next(); | 2087 int output_index = iterator->Next(); |
| 2138 unsigned output_offset = | 2088 unsigned output_offset = |
| 2139 output->GetOffsetFromSlotIndex(output_index); | 2089 output->GetOffsetFromSlotIndex(output_index); |
| 2140 if (FLAG_trace_osr) { | 2090 if (FLAG_trace_osr) { |
| 2141 PrintF(" [sp + %d] <- %d (int32) ; [sp + %d]\n", | 2091 PrintF(" [sp + %d] <- %d (int32) ; [sp + %d]\n", |
| 2142 output_offset, | 2092 output_offset, |
| 2143 int32_value, | 2093 int32_value, |
| 2144 *input_offset); | 2094 *input_offset); |
| 2145 } | 2095 } |
| 2146 output->SetFrameSlot(output_offset, int32_value); | 2096 output->SetFrameSlot(output_offset, int32_value); |
| 2147 break; | 2097 break; |
| 2148 } | 2098 } |
| 2149 | 2099 |
| 2150 case Translation::UINT32_STACK_SLOT: { | 2100 case Translation::UINT32_STACK_SLOT: { |
| 2151 uint32_t uint32_value = 0; | 2101 uint32_t uint32_value = 0; |
| 2152 if (!ObjectToUint32(input_object, &uint32_value)) return false; | 2102 if (!input_object->ToUint32(&uint32_value)) return false; |
| 2153 | 2103 |
| 2154 int output_index = iterator->Next(); | 2104 int output_index = iterator->Next(); |
| 2155 unsigned output_offset = | 2105 unsigned output_offset = |
| 2156 output->GetOffsetFromSlotIndex(output_index); | 2106 output->GetOffsetFromSlotIndex(output_index); |
| 2157 if (FLAG_trace_osr) { | 2107 if (FLAG_trace_osr) { |
| 2158 PrintF(" [sp + %d] <- %u (uint32) ; [sp + %d]\n", | 2108 PrintF(" [sp + %d] <- %u (uint32) ; [sp + %d]\n", |
| 2159 output_offset, | 2109 output_offset, |
| 2160 uint32_value, | 2110 uint32_value, |
| 2161 *input_offset); | 2111 *input_offset); |
| 2162 } | 2112 } |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2949 | 2899 |
| 2950 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 2900 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 2951 v->VisitPointer(BitCast<Object**>(&function_)); | 2901 v->VisitPointer(BitCast<Object**>(&function_)); |
| 2952 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 2902 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 2953 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 2903 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 2954 } | 2904 } |
| 2955 | 2905 |
| 2956 #endif // ENABLE_DEBUGGER_SUPPORT | 2906 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2957 | 2907 |
| 2958 } } // namespace v8::internal | 2908 } } // namespace v8::internal |
| OLD | NEW |