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

Side by Side Diff: src/deoptimizer.cc

Issue 1055453006: Materialize booleans in the turbofan deoptimizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/objects.cc » ('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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 case Translation::SETTER_STUB_FRAME: 822 case Translation::SETTER_STUB_FRAME:
823 DoComputeAccessorStubFrame(&iterator, i, true); 823 DoComputeAccessorStubFrame(&iterator, i, true);
824 break; 824 break;
825 case Translation::COMPILED_STUB_FRAME: 825 case Translation::COMPILED_STUB_FRAME:
826 DoComputeCompiledStubFrame(&iterator, i); 826 DoComputeCompiledStubFrame(&iterator, i);
827 break; 827 break;
828 case Translation::BEGIN: 828 case Translation::BEGIN:
829 case Translation::REGISTER: 829 case Translation::REGISTER:
830 case Translation::INT32_REGISTER: 830 case Translation::INT32_REGISTER:
831 case Translation::UINT32_REGISTER: 831 case Translation::UINT32_REGISTER:
832 case Translation::BOOL_REGISTER:
832 case Translation::DOUBLE_REGISTER: 833 case Translation::DOUBLE_REGISTER:
833 case Translation::STACK_SLOT: 834 case Translation::STACK_SLOT:
834 case Translation::INT32_STACK_SLOT: 835 case Translation::INT32_STACK_SLOT:
835 case Translation::UINT32_STACK_SLOT: 836 case Translation::UINT32_STACK_SLOT:
837 case Translation::BOOL_STACK_SLOT:
836 case Translation::DOUBLE_STACK_SLOT: 838 case Translation::DOUBLE_STACK_SLOT:
837 case Translation::LITERAL: 839 case Translation::LITERAL:
838 case Translation::ARGUMENTS_OBJECT: 840 case Translation::ARGUMENTS_OBJECT:
839 default: 841 case Translation::DUPLICATED_OBJECT:
842 case Translation::CAPTURED_OBJECT:
840 FATAL("Unsupported translation"); 843 FATAL("Unsupported translation");
841 break; 844 break;
842 } 845 }
843 } 846 }
844 847
845 // Print some helpful diagnostic information. 848 // Print some helpful diagnostic information.
846 if (trace_scope_ != NULL) { 849 if (trace_scope_ != NULL) {
847 double ms = timer.Elapsed().InMillisecondsF(); 850 double ms = timer.Elapsed().InMillisecondsF();
848 int index = output_count_ - 1; // Index of the topmost frame. 851 int index = output_count_ - 1; // Index of the topmost frame.
849 PrintF(trace_scope_->file(), "[deoptimizing (%s): end ", 852 PrintF(trace_scope_->file(), "[deoptimizing (%s): end ",
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 case Translation::GETTER_STUB_FRAME: 2097 case Translation::GETTER_STUB_FRAME:
2095 case Translation::SETTER_STUB_FRAME: 2098 case Translation::SETTER_STUB_FRAME:
2096 case Translation::COMPILED_STUB_FRAME: { 2099 case Translation::COMPILED_STUB_FRAME: {
2097 FATAL("Unexpected frame start translation opcode"); 2100 FATAL("Unexpected frame start translation opcode");
2098 return; 2101 return;
2099 } 2102 }
2100 2103
2101 case Translation::REGISTER: 2104 case Translation::REGISTER:
2102 case Translation::INT32_REGISTER: 2105 case Translation::INT32_REGISTER:
2103 case Translation::UINT32_REGISTER: 2106 case Translation::UINT32_REGISTER:
2107 case Translation::BOOL_REGISTER:
2104 case Translation::DOUBLE_REGISTER: 2108 case Translation::DOUBLE_REGISTER:
2105 case Translation::STACK_SLOT: 2109 case Translation::STACK_SLOT:
2106 case Translation::INT32_STACK_SLOT: 2110 case Translation::INT32_STACK_SLOT:
2107 case Translation::UINT32_STACK_SLOT: 2111 case Translation::UINT32_STACK_SLOT:
2112 case Translation::BOOL_STACK_SLOT:
2108 case Translation::DOUBLE_STACK_SLOT: 2113 case Translation::DOUBLE_STACK_SLOT:
2109 case Translation::LITERAL: { 2114 case Translation::LITERAL: {
2110 // The value is not part of any materialized object, so we can ignore it. 2115 // The value is not part of any materialized object, so we can ignore it.
2111 iterator->Skip(Translation::NumberOfOperandsFor(opcode)); 2116 iterator->Skip(Translation::NumberOfOperandsFor(opcode));
2112 return; 2117 return;
2113 } 2118 }
2114 2119
2115 case Translation::DUPLICATED_OBJECT: { 2120 case Translation::DUPLICATED_OBJECT: {
2116 int object_index = iterator->Next(); 2121 int object_index = iterator->Next();
2117 if (trace_scope_ != NULL) { 2122 if (trace_scope_ != NULL) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 intptr_t tagged_value = 2235 intptr_t tagged_value =
2231 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); 2236 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value)));
2232 AddObjectTaggedValue(tagged_value); 2237 AddObjectTaggedValue(tagged_value);
2233 } else { 2238 } else {
2234 double double_value = static_cast<double>(static_cast<uint32_t>(value)); 2239 double double_value = static_cast<double>(static_cast<uint32_t>(value));
2235 AddObjectDoubleValue(double_value); 2240 AddObjectDoubleValue(double_value);
2236 } 2241 }
2237 return; 2242 return;
2238 } 2243 }
2239 2244
2245 case Translation::BOOL_REGISTER: {
2246 int input_reg = iterator->Next();
2247 uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg));
2248 bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue));
2249 if (trace_scope_ != NULL) {
2250 PrintF(trace_scope_->file(),
2251 " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
2252 reinterpret_cast<intptr_t>(object_slot), field_index);
2253 PrintF(trace_scope_->file(), "%" V8PRIuPTR " ; bool %s (%s)\n", value,
2254 converter.NameOfCPURegister(input_reg), TraceValueType(is_smi));
2255 }
2256 if (value == 0) {
2257 AddObjectTaggedValue(
2258 reinterpret_cast<intptr_t>(isolate_->heap()->false_value()));
2259 } else {
2260 DCHECK_EQ(1, value);
2261 AddObjectTaggedValue(
2262 reinterpret_cast<intptr_t>(isolate_->heap()->true_value()));
2263 }
2264 return;
2265 }
2266
2240 case Translation::DOUBLE_REGISTER: { 2267 case Translation::DOUBLE_REGISTER: {
2241 int input_reg = iterator->Next(); 2268 int input_reg = iterator->Next();
2242 double value = input_->GetDoubleRegister(input_reg); 2269 double value = input_->GetDoubleRegister(input_reg);
2243 if (trace_scope_ != NULL) { 2270 if (trace_scope_ != NULL) {
2244 PrintF(trace_scope_->file(), 2271 PrintF(trace_scope_->file(),
2245 " object @0x%08" V8PRIxPTR ": [field #%d] <- ", 2272 " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
2246 reinterpret_cast<intptr_t>(object_slot), 2273 reinterpret_cast<intptr_t>(object_slot),
2247 field_index); 2274 field_index);
2248 PrintF(trace_scope_->file(), 2275 PrintF(trace_scope_->file(),
2249 "%e ; %s\n", value, 2276 "%e ; %s\n", value,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 intptr_t tagged_value = 2343 intptr_t tagged_value =
2317 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value))); 2344 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(value)));
2318 AddObjectTaggedValue(tagged_value); 2345 AddObjectTaggedValue(tagged_value);
2319 } else { 2346 } else {
2320 double double_value = static_cast<double>(static_cast<uint32_t>(value)); 2347 double double_value = static_cast<double>(static_cast<uint32_t>(value));
2321 AddObjectDoubleValue(double_value); 2348 AddObjectDoubleValue(double_value);
2322 } 2349 }
2323 return; 2350 return;
2324 } 2351 }
2325 2352
2353 case Translation::BOOL_STACK_SLOT: {
2354 int input_slot_index = iterator->Next();
2355 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
2356 uintptr_t value =
2357 static_cast<uintptr_t>(input_->GetFrameSlot(input_offset));
2358 bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue));
2359 if (trace_scope_ != NULL) {
2360 PrintF(trace_scope_->file(),
2361 " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
2362 reinterpret_cast<intptr_t>(object_slot), field_index);
2363 PrintF(trace_scope_->file(), "%" V8PRIuPTR " ; [sp + %d] (bool %s)\n",
2364 value, input_offset, TraceValueType(is_smi));
2365 }
2366 if (value == 0) {
2367 AddObjectTaggedValue(
2368 reinterpret_cast<intptr_t>(isolate_->heap()->false_value()));
2369 } else {
2370 DCHECK_EQ(1, value);
2371 AddObjectTaggedValue(
2372 reinterpret_cast<intptr_t>(isolate_->heap()->true_value()));
2373 }
2374 return;
2375 }
2376
2326 case Translation::DOUBLE_STACK_SLOT: { 2377 case Translation::DOUBLE_STACK_SLOT: {
2327 int input_slot_index = iterator->Next(); 2378 int input_slot_index = iterator->Next();
2328 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); 2379 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
2329 double value = input_->GetDoubleFrameSlot(input_offset); 2380 double value = input_->GetDoubleFrameSlot(input_offset);
2330 if (trace_scope_ != NULL) { 2381 if (trace_scope_ != NULL) {
2331 PrintF(trace_scope_->file(), 2382 PrintF(trace_scope_->file(),
2332 " object @0x%08" V8PRIxPTR ": [field #%d] <- ", 2383 " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
2333 reinterpret_cast<intptr_t>(object_slot), 2384 reinterpret_cast<intptr_t>(object_slot),
2334 field_index); 2385 field_index);
2335 PrintF(trace_scope_->file(), 2386 PrintF(trace_scope_->file(),
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 } else { 2549 } else {
2499 // We save the untagged value on the side and store a GC-safe 2550 // We save the untagged value on the side and store a GC-safe
2500 // temporary placeholder in the frame. 2551 // temporary placeholder in the frame.
2501 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, 2552 AddDoubleValue(output_[frame_index]->GetTop() + output_offset,
2502 static_cast<double>(static_cast<uint32_t>(value))); 2553 static_cast<double>(static_cast<uint32_t>(value)));
2503 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); 2554 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
2504 } 2555 }
2505 return; 2556 return;
2506 } 2557 }
2507 2558
2559 case Translation::BOOL_REGISTER: {
2560 int input_reg = iterator->Next();
2561 uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg));
2562 bool is_smi = value <= static_cast<uintptr_t>(Smi::kMaxValue);
2563 if (trace_scope_ != NULL) {
2564 PrintF(trace_scope_->file(),
2565 " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIuPTR
2566 " ; bool %s (%s)\n",
2567 output_[frame_index]->GetTop() + output_offset, output_offset,
2568 value, converter.NameOfCPURegister(input_reg),
2569 TraceValueType(is_smi));
2570 }
2571 if (value == 0) {
2572 output_[frame_index]->SetFrameSlot(
2573 output_offset,
2574 reinterpret_cast<intptr_t>(isolate_->heap()->false_value()));
2575 } else {
2576 DCHECK_EQ(1, value);
2577 output_[frame_index]->SetFrameSlot(
2578 output_offset,
2579 reinterpret_cast<intptr_t>(isolate_->heap()->true_value()));
2580 }
2581 return;
2582 }
2583
2508 case Translation::DOUBLE_REGISTER: { 2584 case Translation::DOUBLE_REGISTER: {
2509 int input_reg = iterator->Next(); 2585 int input_reg = iterator->Next();
2510 double value = input_->GetDoubleRegister(input_reg); 2586 double value = input_->GetDoubleRegister(input_reg);
2511 if (trace_scope_ != NULL) { 2587 if (trace_scope_ != NULL) {
2512 PrintF(trace_scope_->file(), 2588 PrintF(trace_scope_->file(),
2513 " 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n", 2589 " 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n",
2514 output_[frame_index]->GetTop() + output_offset, 2590 output_[frame_index]->GetTop() + output_offset,
2515 output_offset, 2591 output_offset,
2516 value, 2592 value,
2517 DoubleRegister::AllocationIndexToString(input_reg)); 2593 DoubleRegister::AllocationIndexToString(input_reg));
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 } else { 2674 } else {
2599 // We save the untagged value on the side and store a GC-safe 2675 // We save the untagged value on the side and store a GC-safe
2600 // temporary placeholder in the frame. 2676 // temporary placeholder in the frame.
2601 AddDoubleValue(output_[frame_index]->GetTop() + output_offset, 2677 AddDoubleValue(output_[frame_index]->GetTop() + output_offset,
2602 static_cast<double>(static_cast<uint32_t>(value))); 2678 static_cast<double>(static_cast<uint32_t>(value)));
2603 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder); 2679 output_[frame_index]->SetFrameSlot(output_offset, kPlaceholder);
2604 } 2680 }
2605 return; 2681 return;
2606 } 2682 }
2607 2683
2684 case Translation::BOOL_STACK_SLOT: {
2685 int input_slot_index = iterator->Next();
2686 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
2687 uintptr_t value =
2688 static_cast<uintptr_t>(input_->GetFrameSlot(input_offset));
2689 bool is_smi = value <= static_cast<uintptr_t>(Smi::kMaxValue);
2690 if (trace_scope_ != NULL) {
2691 PrintF(trace_scope_->file(), " 0x%08" V8PRIxPTR ": ",
2692 output_[frame_index]->GetTop() + output_offset);
2693 PrintF(trace_scope_->file(),
2694 "[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n",
2695 output_offset, value, input_offset, TraceValueType(is_smi));
2696 }
2697 if (value == 0) {
2698 output_[frame_index]->SetFrameSlot(
2699 output_offset,
2700 reinterpret_cast<intptr_t>(isolate_->heap()->false_value()));
2701 } else {
2702 DCHECK_EQ(1, value);
2703 output_[frame_index]->SetFrameSlot(
2704 output_offset,
2705 reinterpret_cast<intptr_t>(isolate_->heap()->true_value()));
2706 }
2707 return;
2708 }
2709
2608 case Translation::DOUBLE_STACK_SLOT: { 2710 case Translation::DOUBLE_STACK_SLOT: {
2609 int input_slot_index = iterator->Next(); 2711 int input_slot_index = iterator->Next();
2610 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index); 2712 unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
2611 double value = input_->GetDoubleFrameSlot(input_offset); 2713 double value = input_->GetDoubleFrameSlot(input_offset);
2612 if (trace_scope_ != NULL) { 2714 if (trace_scope_ != NULL) {
2613 PrintF(trace_scope_->file(), 2715 PrintF(trace_scope_->file(),
2614 " 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n", 2716 " 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n",
2615 output_[frame_index]->GetTop() + output_offset, 2717 output_[frame_index]->GetTop() + output_offset,
2616 output_offset, 2718 output_offset,
2617 value, 2719 value,
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 buffer_->Add(reg.code(), zone()); 3115 buffer_->Add(reg.code(), zone());
3014 } 3116 }
3015 3117
3016 3118
3017 void Translation::StoreUint32Register(Register reg) { 3119 void Translation::StoreUint32Register(Register reg) {
3018 buffer_->Add(UINT32_REGISTER, zone()); 3120 buffer_->Add(UINT32_REGISTER, zone());
3019 buffer_->Add(reg.code(), zone()); 3121 buffer_->Add(reg.code(), zone());
3020 } 3122 }
3021 3123
3022 3124
3125 void Translation::StoreBoolRegister(Register reg) {
3126 buffer_->Add(BOOL_REGISTER, zone());
3127 buffer_->Add(reg.code(), zone());
3128 }
3129
3130
3023 void Translation::StoreDoubleRegister(DoubleRegister reg) { 3131 void Translation::StoreDoubleRegister(DoubleRegister reg) {
3024 buffer_->Add(DOUBLE_REGISTER, zone()); 3132 buffer_->Add(DOUBLE_REGISTER, zone());
3025 buffer_->Add(DoubleRegister::ToAllocationIndex(reg), zone()); 3133 buffer_->Add(DoubleRegister::ToAllocationIndex(reg), zone());
3026 } 3134 }
3027 3135
3028 3136
3029 void Translation::StoreStackSlot(int index) { 3137 void Translation::StoreStackSlot(int index) {
3030 buffer_->Add(STACK_SLOT, zone()); 3138 buffer_->Add(STACK_SLOT, zone());
3031 buffer_->Add(index, zone()); 3139 buffer_->Add(index, zone());
3032 } 3140 }
3033 3141
3034 3142
3035 void Translation::StoreInt32StackSlot(int index) { 3143 void Translation::StoreInt32StackSlot(int index) {
3036 buffer_->Add(INT32_STACK_SLOT, zone()); 3144 buffer_->Add(INT32_STACK_SLOT, zone());
3037 buffer_->Add(index, zone()); 3145 buffer_->Add(index, zone());
3038 } 3146 }
3039 3147
3040 3148
3041 void Translation::StoreUint32StackSlot(int index) { 3149 void Translation::StoreUint32StackSlot(int index) {
3042 buffer_->Add(UINT32_STACK_SLOT, zone()); 3150 buffer_->Add(UINT32_STACK_SLOT, zone());
3043 buffer_->Add(index, zone()); 3151 buffer_->Add(index, zone());
3044 } 3152 }
3045 3153
3046 3154
3155 void Translation::StoreBoolStackSlot(int index) {
3156 buffer_->Add(BOOL_STACK_SLOT, zone());
3157 buffer_->Add(index, zone());
3158 }
3159
3160
3047 void Translation::StoreDoubleStackSlot(int index) { 3161 void Translation::StoreDoubleStackSlot(int index) {
3048 buffer_->Add(DOUBLE_STACK_SLOT, zone()); 3162 buffer_->Add(DOUBLE_STACK_SLOT, zone());
3049 buffer_->Add(index, zone()); 3163 buffer_->Add(index, zone());
3050 } 3164 }
3051 3165
3052 3166
3053 void Translation::StoreLiteral(int literal_id) { 3167 void Translation::StoreLiteral(int literal_id) {
3054 buffer_->Add(LITERAL, zone()); 3168 buffer_->Add(LITERAL, zone());
3055 buffer_->Add(literal_id, zone()); 3169 buffer_->Add(literal_id, zone());
3056 } 3170 }
(...skipping 12 matching lines...) Expand all
3069 int Translation::NumberOfOperandsFor(Opcode opcode) { 3183 int Translation::NumberOfOperandsFor(Opcode opcode) {
3070 switch (opcode) { 3184 switch (opcode) {
3071 case GETTER_STUB_FRAME: 3185 case GETTER_STUB_FRAME:
3072 case SETTER_STUB_FRAME: 3186 case SETTER_STUB_FRAME:
3073 case DUPLICATED_OBJECT: 3187 case DUPLICATED_OBJECT:
3074 case ARGUMENTS_OBJECT: 3188 case ARGUMENTS_OBJECT:
3075 case CAPTURED_OBJECT: 3189 case CAPTURED_OBJECT:
3076 case REGISTER: 3190 case REGISTER:
3077 case INT32_REGISTER: 3191 case INT32_REGISTER:
3078 case UINT32_REGISTER: 3192 case UINT32_REGISTER:
3193 case BOOL_REGISTER:
3079 case DOUBLE_REGISTER: 3194 case DOUBLE_REGISTER:
3080 case STACK_SLOT: 3195 case STACK_SLOT:
3081 case INT32_STACK_SLOT: 3196 case INT32_STACK_SLOT:
3082 case UINT32_STACK_SLOT: 3197 case UINT32_STACK_SLOT:
3198 case BOOL_STACK_SLOT:
3083 case DOUBLE_STACK_SLOT: 3199 case DOUBLE_STACK_SLOT:
3084 case LITERAL: 3200 case LITERAL:
3085 case COMPILED_STUB_FRAME: 3201 case COMPILED_STUB_FRAME:
3086 return 1; 3202 return 1;
3087 case BEGIN: 3203 case BEGIN:
3088 case ARGUMENTS_ADAPTOR_FRAME: 3204 case ARGUMENTS_ADAPTOR_FRAME:
3089 case CONSTRUCT_STUB_FRAME: 3205 case CONSTRUCT_STUB_FRAME:
3090 return 2; 3206 return 2;
3091 case JS_FRAME: 3207 case JS_FRAME:
3092 return 3; 3208 return 3;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 case Translation::ARGUMENTS_OBJECT: 3252 case Translation::ARGUMENTS_OBJECT:
3137 return SlotRef::NewArgumentsObject(iterator->Next()); 3253 return SlotRef::NewArgumentsObject(iterator->Next());
3138 3254
3139 case Translation::CAPTURED_OBJECT: { 3255 case Translation::CAPTURED_OBJECT: {
3140 return SlotRef::NewDeferredObject(iterator->Next()); 3256 return SlotRef::NewDeferredObject(iterator->Next());
3141 } 3257 }
3142 3258
3143 case Translation::REGISTER: 3259 case Translation::REGISTER:
3144 case Translation::INT32_REGISTER: 3260 case Translation::INT32_REGISTER:
3145 case Translation::UINT32_REGISTER: 3261 case Translation::UINT32_REGISTER:
3262 case Translation::BOOL_REGISTER:
3146 case Translation::DOUBLE_REGISTER: 3263 case Translation::DOUBLE_REGISTER:
3147 // We are at safepoint which corresponds to call. All registers are 3264 // We are at safepoint which corresponds to call. All registers are
3148 // saved by caller so there would be no live registers at this 3265 // saved by caller so there would be no live registers at this
3149 // point. Thus these translation commands should not be used. 3266 // point. Thus these translation commands should not be used.
3150 break; 3267 break;
3151 3268
3152 case Translation::STACK_SLOT: { 3269 case Translation::STACK_SLOT: {
3153 int slot_index = iterator->Next(); 3270 int slot_index = iterator->Next();
3154 Address slot_addr = SlotAddress(frame, slot_index); 3271 Address slot_addr = SlotAddress(frame, slot_index);
3155 return SlotRef(slot_addr, SlotRef::TAGGED); 3272 return SlotRef(slot_addr, SlotRef::TAGGED);
3156 } 3273 }
3157 3274
3158 case Translation::INT32_STACK_SLOT: { 3275 case Translation::INT32_STACK_SLOT: {
3159 int slot_index = iterator->Next(); 3276 int slot_index = iterator->Next();
3160 Address slot_addr = SlotAddress(frame, slot_index); 3277 Address slot_addr = SlotAddress(frame, slot_index);
3161 return SlotRef(slot_addr, SlotRef::INT32); 3278 return SlotRef(slot_addr, SlotRef::INT32);
3162 } 3279 }
3163 3280
3164 case Translation::UINT32_STACK_SLOT: { 3281 case Translation::UINT32_STACK_SLOT: {
3165 int slot_index = iterator->Next(); 3282 int slot_index = iterator->Next();
3166 Address slot_addr = SlotAddress(frame, slot_index); 3283 Address slot_addr = SlotAddress(frame, slot_index);
3167 return SlotRef(slot_addr, SlotRef::UINT32); 3284 return SlotRef(slot_addr, SlotRef::UINT32);
3168 } 3285 }
3169 3286
3287 case Translation::BOOL_STACK_SLOT: {
3288 int slot_index = iterator->Next();
3289 Address slot_addr = SlotAddress(frame, slot_index);
3290 return SlotRef(slot_addr, SlotRef::BOOLBIT);
3291 }
3292
3170 case Translation::DOUBLE_STACK_SLOT: { 3293 case Translation::DOUBLE_STACK_SLOT: {
3171 int slot_index = iterator->Next(); 3294 int slot_index = iterator->Next();
3172 Address slot_addr = SlotAddress(frame, slot_index); 3295 Address slot_addr = SlotAddress(frame, slot_index);
3173 return SlotRef(slot_addr, SlotRef::DOUBLE); 3296 return SlotRef(slot_addr, SlotRef::DOUBLE);
3174 } 3297 }
3175 3298
3176 case Translation::LITERAL: { 3299 case Translation::LITERAL: {
3177 int literal_index = iterator->Next(); 3300 int literal_index = iterator->Next();
3178 return SlotRef(data->GetIsolate(), 3301 return SlotRef(data->GetIsolate(),
3179 data->LiteralArray()->get(literal_index)); 3302 data->LiteralArray()->get(literal_index));
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 #else 3440 #else
3318 uint32_t value = Memory::uint32_at(addr_); 3441 uint32_t value = Memory::uint32_at(addr_);
3319 #endif 3442 #endif
3320 if (value <= static_cast<uint32_t>(Smi::kMaxValue)) { 3443 if (value <= static_cast<uint32_t>(Smi::kMaxValue)) {
3321 return Handle<Object>(Smi::FromInt(static_cast<int>(value)), isolate); 3444 return Handle<Object>(Smi::FromInt(static_cast<int>(value)), isolate);
3322 } else { 3445 } else {
3323 return isolate->factory()->NewNumber(static_cast<double>(value)); 3446 return isolate->factory()->NewNumber(static_cast<double>(value));
3324 } 3447 }
3325 } 3448 }
3326 3449
3450 case BOOLBIT: {
3451 #if V8_TARGET_BIG_ENDIAN && V8_HOST_ARCH_64_BIT
3452 uint32_t value = Memory::uint32_at(addr_ + kIntSize);
3453 #else
3454 uint32_t value = Memory::uint32_at(addr_);
3455 #endif
3456 if (value == 0) {
3457 return isolate->factory()->false_value();
3458 } else {
3459 DCHECK_EQ(1, value);
3460 return isolate->factory()->true_value();
3461 }
3462 }
3463
3327 case DOUBLE: { 3464 case DOUBLE: {
3328 double value = read_double_value(addr_); 3465 double value = read_double_value(addr_);
3329 return isolate->factory()->NewNumber(value); 3466 return isolate->factory()->NewNumber(value);
3330 } 3467 }
3331 3468
3332 case LITERAL: 3469 case LITERAL:
3333 return literal_; 3470 return literal_;
3334 3471
3335 default: 3472 default:
3336 FATAL("We should never get here - unexpected deopt info."); 3473 FATAL("We should never get here - unexpected deopt info.");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 } 3526 }
3390 3527
3391 3528
3392 Handle<Object> SlotRefValueBuilder::GetNext(Isolate* isolate, int lvl) { 3529 Handle<Object> SlotRefValueBuilder::GetNext(Isolate* isolate, int lvl) {
3393 SlotRef& slot = slot_refs_[current_slot_]; 3530 SlotRef& slot = slot_refs_[current_slot_];
3394 current_slot_++; 3531 current_slot_++;
3395 switch (slot.Representation()) { 3532 switch (slot.Representation()) {
3396 case SlotRef::TAGGED: 3533 case SlotRef::TAGGED:
3397 case SlotRef::INT32: 3534 case SlotRef::INT32:
3398 case SlotRef::UINT32: 3535 case SlotRef::UINT32:
3536 case SlotRef::BOOLBIT:
3399 case SlotRef::DOUBLE: 3537 case SlotRef::DOUBLE:
3400 case SlotRef::LITERAL: 3538 case SlotRef::LITERAL:
3401 return slot.GetValue(isolate); 3539 return slot.GetValue(isolate);
3402 3540
3403 case SlotRef::ARGUMENTS_OBJECT: { 3541 case SlotRef::ARGUMENTS_OBJECT: {
3404 // We should never need to materialize an arguments object, 3542 // We should never need to materialize an arguments object,
3405 // but we still need to put something into the array 3543 // but we still need to put something into the array
3406 // so that the indexing is consistent. 3544 // so that the indexing is consistent.
3407 materialized_objects_.Add(isolate->factory()->undefined_value()); 3545 materialized_objects_.Add(isolate->factory()->undefined_value());
3408 int length = slot.GetChildrenCount(); 3546 int length = slot.GetChildrenCount();
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 int raw_position = static_cast<int>(info->data()); 3800 int raw_position = static_cast<int>(info->data());
3663 last_position = raw_position ? SourcePosition::FromRaw(raw_position) 3801 last_position = raw_position ? SourcePosition::FromRaw(raw_position)
3664 : SourcePosition::Unknown(); 3802 : SourcePosition::Unknown();
3665 } else if (info->rmode() == RelocInfo::DEOPT_REASON) { 3803 } else if (info->rmode() == RelocInfo::DEOPT_REASON) {
3666 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data()); 3804 last_reason = static_cast<Deoptimizer::DeoptReason>(info->data());
3667 } 3805 }
3668 } 3806 }
3669 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason); 3807 return DeoptInfo(SourcePosition::Unknown(), NULL, Deoptimizer::kNoReason);
3670 } 3808 }
3671 } } // namespace v8::internal 3809 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698