| 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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 ? input_->GetFrameSlot(input_offset) | 1979 ? input_->GetFrameSlot(input_offset) |
| 1980 : reinterpret_cast<intptr_t>(isolate_->heap()->the_hole_value()); | 1980 : reinterpret_cast<intptr_t>(isolate_->heap()->the_hole_value()); |
| 1981 AddArgumentsObjectValue(input_value); | 1981 AddArgumentsObjectValue(input_value); |
| 1982 } | 1982 } |
| 1983 return; | 1983 return; |
| 1984 } | 1984 } |
| 1985 } | 1985 } |
| 1986 } | 1986 } |
| 1987 | 1987 |
| 1988 | 1988 |
| 1989 static bool ObjectToInt32(Object* obj, int32_t* value) { | |
| 1990 if (obj->IsSmi()) { | |
| 1991 *value = Smi::cast(obj)->value(); | |
| 1992 return true; | |
| 1993 } | |
| 1994 | |
| 1995 if (obj->IsHeapNumber()) { | |
| 1996 double num = HeapNumber::cast(obj)->value(); | |
| 1997 if (FastI2D(FastD2I(num)) != num) { | |
| 1998 if (FLAG_trace_osr) { | |
| 1999 PrintF("**** %g could not be converted to int32 ****\n", | |
| 2000 HeapNumber::cast(obj)->value()); | |
| 2001 } | |
| 2002 return false; | |
| 2003 } | |
| 2004 | |
| 2005 *value = FastD2I(num); | |
| 2006 return true; | |
| 2007 } | |
| 2008 | |
| 2009 return false; | |
| 2010 } | |
| 2011 | |
| 2012 | |
| 2013 static bool ObjectToUint32(Object* obj, uint32_t* value) { | |
| 2014 if (obj->IsSmi()) { | |
| 2015 if (Smi::cast(obj)->value() < 0) return false; | |
| 2016 | |
| 2017 *value = static_cast<uint32_t>(Smi::cast(obj)->value()); | |
| 2018 return true; | |
| 2019 } | |
| 2020 | |
| 2021 if (obj->IsHeapNumber()) { | |
| 2022 double num = HeapNumber::cast(obj)->value(); | |
| 2023 if ((num < 0) || (FastUI2D(FastD2UI(num)) != num)) { | |
| 2024 if (FLAG_trace_osr) { | |
| 2025 PrintF("**** %g could not be converted to uint32 ****\n", | |
| 2026 HeapNumber::cast(obj)->value()); | |
| 2027 } | |
| 2028 return false; | |
| 2029 } | |
| 2030 | |
| 2031 *value = FastD2UI(num); | |
| 2032 return true; | |
| 2033 } | |
| 2034 | |
| 2035 return false; | |
| 2036 } | |
| 2037 | |
| 2038 | |
| 2039 bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, | 1989 bool Deoptimizer::DoOsrTranslateCommand(TranslationIterator* iterator, |
| 2040 int* input_offset) { | 1990 int* input_offset) { |
| 2041 disasm::NameConverter converter; | 1991 disasm::NameConverter converter; |
| 2042 FrameDescription* output = output_[0]; | 1992 FrameDescription* output = output_[0]; |
| 2043 | 1993 |
| 2044 // The input values are all part of the unoptimized frame so they | 1994 // The input values are all part of the unoptimized frame so they |
| 2045 // are all tagged pointers. | 1995 // are all tagged pointers. |
| 2046 uintptr_t input_value = input_->GetFrameSlot(*input_offset); | 1996 uintptr_t input_value = input_->GetFrameSlot(*input_offset); |
| 2047 Object* input_object = reinterpret_cast<Object*>(input_value); | 1997 Object* input_object = reinterpret_cast<Object*>(input_value); |
| 2048 | 1998 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2072 converter.NameOfCPURegister(output_reg), | 2022 converter.NameOfCPURegister(output_reg), |
| 2073 input_value, | 2023 input_value, |
| 2074 *input_offset); | 2024 *input_offset); |
| 2075 } | 2025 } |
| 2076 output->SetRegister(output_reg, input_value); | 2026 output->SetRegister(output_reg, input_value); |
| 2077 break; | 2027 break; |
| 2078 } | 2028 } |
| 2079 | 2029 |
| 2080 case Translation::INT32_REGISTER: { | 2030 case Translation::INT32_REGISTER: { |
| 2081 int32_t int32_value = 0; | 2031 int32_t int32_value = 0; |
| 2082 if (!ObjectToInt32(input_object, &int32_value)) return false; | 2032 if (!input_object->ToInt32(&int32_value)) return false; |
| 2083 | 2033 |
| 2084 int output_reg = iterator->Next(); | 2034 int output_reg = iterator->Next(); |
| 2085 if (FLAG_trace_osr) { | 2035 if (FLAG_trace_osr) { |
| 2086 PrintF(" %s <- %d (int32) ; [sp + %d]\n", | 2036 PrintF(" %s <- %d (int32) ; [sp + %d]\n", |
| 2087 converter.NameOfCPURegister(output_reg), | 2037 converter.NameOfCPURegister(output_reg), |
| 2088 int32_value, | 2038 int32_value, |
| 2089 *input_offset); | 2039 *input_offset); |
| 2090 } | 2040 } |
| 2091 output->SetRegister(output_reg, int32_value); | 2041 output->SetRegister(output_reg, int32_value); |
| 2092 break; | 2042 break; |
| 2093 } | 2043 } |
| 2094 | 2044 |
| 2095 case Translation::UINT32_REGISTER: { | 2045 case Translation::UINT32_REGISTER: { |
| 2096 uint32_t uint32_value = 0; | 2046 uint32_t uint32_value = 0; |
| 2097 if (!ObjectToUint32(input_object, &uint32_value)) return false; | 2047 if (!input_object->ToUint32(&uint32_value)) return false; |
| 2098 | 2048 |
| 2099 int output_reg = iterator->Next(); | 2049 int output_reg = iterator->Next(); |
| 2100 if (FLAG_trace_osr) { | 2050 if (FLAG_trace_osr) { |
| 2101 PrintF(" %s <- %u (uint32) ; [sp + %d]\n", | 2051 PrintF(" %s <- %u (uint32) ; [sp + %d]\n", |
| 2102 converter.NameOfCPURegister(output_reg), | 2052 converter.NameOfCPURegister(output_reg), |
| 2103 uint32_value, | 2053 uint32_value, |
| 2104 *input_offset); | 2054 *input_offset); |
| 2105 } | 2055 } |
| 2106 output->SetRegister(output_reg, static_cast<int32_t>(uint32_value)); | 2056 output->SetRegister(output_reg, static_cast<int32_t>(uint32_value)); |
| 2107 } | 2057 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2134 *input_offset); | 2084 *input_offset); |
| 2135 reinterpret_cast<Object*>(input_value)->ShortPrint(); | 2085 reinterpret_cast<Object*>(input_value)->ShortPrint(); |
| 2136 PrintF("\n"); | 2086 PrintF("\n"); |
| 2137 } | 2087 } |
| 2138 output->SetFrameSlot(output_offset, input_value); | 2088 output->SetFrameSlot(output_offset, input_value); |
| 2139 break; | 2089 break; |
| 2140 } | 2090 } |
| 2141 | 2091 |
| 2142 case Translation::INT32_STACK_SLOT: { | 2092 case Translation::INT32_STACK_SLOT: { |
| 2143 int32_t int32_value = 0; | 2093 int32_t int32_value = 0; |
| 2144 if (!ObjectToInt32(input_object, &int32_value)) return false; | 2094 if (!input_object->ToInt32(&int32_value)) return false; |
| 2145 | 2095 |
| 2146 int output_index = iterator->Next(); | 2096 int output_index = iterator->Next(); |
| 2147 unsigned output_offset = | 2097 unsigned output_offset = |
| 2148 output->GetOffsetFromSlotIndex(output_index); | 2098 output->GetOffsetFromSlotIndex(output_index); |
| 2149 if (FLAG_trace_osr) { | 2099 if (FLAG_trace_osr) { |
| 2150 PrintF(" [sp + %d] <- %d (int32) ; [sp + %d]\n", | 2100 PrintF(" [sp + %d] <- %d (int32) ; [sp + %d]\n", |
| 2151 output_offset, | 2101 output_offset, |
| 2152 int32_value, | 2102 int32_value, |
| 2153 *input_offset); | 2103 *input_offset); |
| 2154 } | 2104 } |
| 2155 output->SetFrameSlot(output_offset, int32_value); | 2105 output->SetFrameSlot(output_offset, int32_value); |
| 2156 break; | 2106 break; |
| 2157 } | 2107 } |
| 2158 | 2108 |
| 2159 case Translation::UINT32_STACK_SLOT: { | 2109 case Translation::UINT32_STACK_SLOT: { |
| 2160 uint32_t uint32_value = 0; | 2110 uint32_t uint32_value = 0; |
| 2161 if (!ObjectToUint32(input_object, &uint32_value)) return false; | 2111 if (!input_object->ToUint32(&uint32_value)) return false; |
| 2162 | 2112 |
| 2163 int output_index = iterator->Next(); | 2113 int output_index = iterator->Next(); |
| 2164 unsigned output_offset = | 2114 unsigned output_offset = |
| 2165 output->GetOffsetFromSlotIndex(output_index); | 2115 output->GetOffsetFromSlotIndex(output_index); |
| 2166 if (FLAG_trace_osr) { | 2116 if (FLAG_trace_osr) { |
| 2167 PrintF(" [sp + %d] <- %u (uint32) ; [sp + %d]\n", | 2117 PrintF(" [sp + %d] <- %u (uint32) ; [sp + %d]\n", |
| 2168 output_offset, | 2118 output_offset, |
| 2169 uint32_value, | 2119 uint32_value, |
| 2170 *input_offset); | 2120 *input_offset); |
| 2171 } | 2121 } |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2958 | 2908 |
| 2959 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 2909 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 2960 v->VisitPointer(BitCast<Object**>(&function_)); | 2910 v->VisitPointer(BitCast<Object**>(&function_)); |
| 2961 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 2911 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 2962 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 2912 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 2963 } | 2913 } |
| 2964 | 2914 |
| 2965 #endif // ENABLE_DEBUGGER_SUPPORT | 2915 #endif // ENABLE_DEBUGGER_SUPPORT |
| 2966 | 2916 |
| 2967 } } // namespace v8::internal | 2917 } } // namespace v8::internal |
| OLD | NEW |