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

Side by Side Diff: src/deoptimizer.cc

Issue 1261923007: [turbofan] Unify referencing of stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/deoptimizer.h ('k') | src/frames.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/cpu-profiler.h" 9 #include "src/cpu-profiler.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 2602
2603 int TranslatedValue::GetChildrenCount() const { 2603 int TranslatedValue::GetChildrenCount() const {
2604 if (kind() == kCapturedObject || kind() == kArgumentsObject) { 2604 if (kind() == kCapturedObject || kind() == kArgumentsObject) {
2605 return object_length(); 2605 return object_length();
2606 } else { 2606 } else {
2607 return 0; 2607 return 0;
2608 } 2608 }
2609 } 2609 }
2610 2610
2611 2611
2612 int TranslatedState::SlotOffsetFp(int slot_index) {
2613 if (slot_index >= 0) {
2614 const int offset = StandardFrameConstants::kExpressionsOffset;
2615 return offset - (slot_index * kPointerSize);
2616 } else {
2617 const int offset = StandardFrameConstants::kCallerSPOffset;
2618 return offset - ((slot_index + 1) * kPointerSize);
2619 }
2620 }
2621
2622
2623 Address TranslatedState::SlotAddress(Address fp, int slot_index) {
2624 return fp + SlotOffsetFp(slot_index);
2625 }
2626
2627
2628 uint32_t TranslatedState::GetUInt32Slot(Address fp, int slot_offset) { 2612 uint32_t TranslatedState::GetUInt32Slot(Address fp, int slot_offset) {
2629 Address address = fp + slot_offset; 2613 Address address = fp + slot_offset;
2630 #if V8_TARGET_BIG_ENDIAN && V8_HOST_ARCH_64_BIT 2614 #if V8_TARGET_BIG_ENDIAN && V8_HOST_ARCH_64_BIT
2631 return Memory::uint32_at(address + kIntSize); 2615 return Memory::uint32_at(address + kIntSize);
2632 #else 2616 #else
2633 return Memory::uint32_at(address); 2617 return Memory::uint32_at(address);
2634 #endif 2618 #endif
2635 } 2619 }
2636 2620
2637 2621
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 if (registers == nullptr) return TranslatedValue::NewInvalid(this); 2924 if (registers == nullptr) return TranslatedValue::NewInvalid(this);
2941 double value = registers->GetDoubleRegister(input_reg); 2925 double value = registers->GetDoubleRegister(input_reg);
2942 if (trace_file != nullptr) { 2926 if (trace_file != nullptr) {
2943 PrintF(trace_file, "%e ; %s (bool)", value, 2927 PrintF(trace_file, "%e ; %s (bool)", value,
2944 DoubleRegister::AllocationIndexToString(input_reg)); 2928 DoubleRegister::AllocationIndexToString(input_reg));
2945 } 2929 }
2946 return TranslatedValue::NewDouble(this, value); 2930 return TranslatedValue::NewDouble(this, value);
2947 } 2931 }
2948 2932
2949 case Translation::STACK_SLOT: { 2933 case Translation::STACK_SLOT: {
2950 int slot_offset = SlotOffsetFp(iterator->Next()); 2934 int slot_offset =
2935 OptimizedFrame::StackSlotOffsetRelativeToFp(iterator->Next());
2951 intptr_t value = *(reinterpret_cast<intptr_t*>(fp + slot_offset)); 2936 intptr_t value = *(reinterpret_cast<intptr_t*>(fp + slot_offset));
2952 if (trace_file != nullptr) { 2937 if (trace_file != nullptr) {
2953 PrintF(trace_file, "0x%08" V8PRIxPTR " ; [fp %c %d] ", value, 2938 PrintF(trace_file, "0x%08" V8PRIxPTR " ; [fp %c %d] ", value,
2954 slot_offset < 0 ? '-' : '+', std::abs(slot_offset)); 2939 slot_offset < 0 ? '-' : '+', std::abs(slot_offset));
2955 reinterpret_cast<Object*>(value)->ShortPrint(trace_file); 2940 reinterpret_cast<Object*>(value)->ShortPrint(trace_file);
2956 } 2941 }
2957 return TranslatedValue::NewTagged(this, reinterpret_cast<Object*>(value)); 2942 return TranslatedValue::NewTagged(this, reinterpret_cast<Object*>(value));
2958 } 2943 }
2959 2944
2960 case Translation::INT32_STACK_SLOT: { 2945 case Translation::INT32_STACK_SLOT: {
2961 int slot_offset = SlotOffsetFp(iterator->Next()); 2946 int slot_offset =
2947 OptimizedFrame::StackSlotOffsetRelativeToFp(iterator->Next());
2962 uint32_t value = GetUInt32Slot(fp, slot_offset); 2948 uint32_t value = GetUInt32Slot(fp, slot_offset);
2963 if (trace_file != nullptr) { 2949 if (trace_file != nullptr) {
2964 PrintF(trace_file, "%d ; (int) [fp %c %d] ", 2950 PrintF(trace_file, "%d ; (int) [fp %c %d] ",
2965 static_cast<int32_t>(value), slot_offset < 0 ? '-' : '+', 2951 static_cast<int32_t>(value), slot_offset < 0 ? '-' : '+',
2966 std::abs(slot_offset)); 2952 std::abs(slot_offset));
2967 } 2953 }
2968 return TranslatedValue::NewInt32(this, value); 2954 return TranslatedValue::NewInt32(this, value);
2969 } 2955 }
2970 2956
2971 case Translation::UINT32_STACK_SLOT: { 2957 case Translation::UINT32_STACK_SLOT: {
2972 int slot_offset = SlotOffsetFp(iterator->Next()); 2958 int slot_offset =
2959 OptimizedFrame::StackSlotOffsetRelativeToFp(iterator->Next());
2973 uint32_t value = GetUInt32Slot(fp, slot_offset); 2960 uint32_t value = GetUInt32Slot(fp, slot_offset);
2974 if (trace_file != nullptr) { 2961 if (trace_file != nullptr) {
2975 PrintF(trace_file, "%u ; (uint) [fp %c %d] ", value, 2962 PrintF(trace_file, "%u ; (uint) [fp %c %d] ", value,
2976 slot_offset < 0 ? '-' : '+', std::abs(slot_offset)); 2963 slot_offset < 0 ? '-' : '+', std::abs(slot_offset));
2977 } 2964 }
2978 return TranslatedValue::NewUInt32(this, value); 2965 return TranslatedValue::NewUInt32(this, value);
2979 } 2966 }
2980 2967
2981 case Translation::BOOL_STACK_SLOT: { 2968 case Translation::BOOL_STACK_SLOT: {
2982 int slot_offset = SlotOffsetFp(iterator->Next()); 2969 int slot_offset =
2970 OptimizedFrame::StackSlotOffsetRelativeToFp(iterator->Next());
2983 uint32_t value = GetUInt32Slot(fp, slot_offset); 2971 uint32_t value = GetUInt32Slot(fp, slot_offset);
2984 if (trace_file != nullptr) { 2972 if (trace_file != nullptr) {
2985 PrintF(trace_file, "%u ; (bool) [fp %c %d] ", value, 2973 PrintF(trace_file, "%u ; (bool) [fp %c %d] ", value,
2986 slot_offset < 0 ? '-' : '+', std::abs(slot_offset)); 2974 slot_offset < 0 ? '-' : '+', std::abs(slot_offset));
2987 } 2975 }
2988 return TranslatedValue::NewBool(this, value); 2976 return TranslatedValue::NewBool(this, value);
2989 } 2977 }
2990 2978
2991 case Translation::DOUBLE_STACK_SLOT: { 2979 case Translation::DOUBLE_STACK_SLOT: {
2992 int slot_offset = SlotOffsetFp(iterator->Next()); 2980 int slot_offset =
2981 OptimizedFrame::StackSlotOffsetRelativeToFp(iterator->Next());
2993 double value = ReadDoubleValue(fp + slot_offset); 2982 double value = ReadDoubleValue(fp + slot_offset);
2994 if (trace_file != nullptr) { 2983 if (trace_file != nullptr) {
2995 PrintF(trace_file, "%e ; (double) [fp %c %d] ", value, 2984 PrintF(trace_file, "%e ; (double) [fp %c %d] ", value,
2996 slot_offset < 0 ? '-' : '+', std::abs(slot_offset)); 2985 slot_offset < 0 ? '-' : '+', std::abs(slot_offset));
2997 } 2986 }
2998 return TranslatedValue::NewDouble(this, value); 2987 return TranslatedValue::NewDouble(this, value);
2999 } 2988 }
3000 2989
3001 case Translation::LITERAL: { 2990 case Translation::LITERAL: {
3002 int literal_index = iterator->Next(); 2991 int literal_index = iterator->Next();
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
3423 DCHECK(value_info->IsMaterializedObject()); 3412 DCHECK(value_info->IsMaterializedObject());
3424 3413
3425 value_info->value_ = 3414 value_info->value_ =
3426 Handle<Object>(previously_materialized_objects->get(i), isolate_); 3415 Handle<Object>(previously_materialized_objects->get(i), isolate_);
3427 } 3416 }
3428 } 3417 }
3429 } 3418 }
3430 3419
3431 } // namespace internal 3420 } // namespace internal
3432 } // namespace v8 3421 } // namespace v8
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698