| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 93c4dc5 commit e938515
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | #define V8_MAJOR_VERSION 10 | |
| 12 | 12 | #define V8_MINOR_VERSION 1 | |
| 13 | 13 | #define V8_BUILD_NUMBER 124 | |
| 14 | - #define V8_PATCH_LEVEL 6 | ||
| 14 | + #define V8_PATCH_LEVEL 8 | ||
| 15 | 15 | ||
| 16 | 16 | // Use 1 for candidates and 0 otherwise. | |
| 17 | 17 | // (Boolean macro values are not supported by all preprocessors.) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,10 +5,12 @@ | |||
| 5 | 5 | #include "src/compiler/escape-analysis.h" | |
| 6 | 6 | ||
| 7 | 7 | #include "src/codegen/tick-counter.h" | |
| 8 | + #include "src/compiler/frame-states.h" | ||
| 8 | 9 | #include "src/compiler/linkage.h" | |
| 9 | 10 | #include "src/compiler/node-matchers.h" | |
| 10 | 11 | #include "src/compiler/operator-properties.h" | |
| 11 | 12 | #include "src/compiler/simplified-operator.h" | |
| 13 | + #include "src/compiler/state-values-utils.h" | ||
| 12 | 14 | #include "src/handles/handles-inl.h" | |
| 13 | 15 | #include "src/init/bootstrapper.h" | |
| 14 | 16 | #include "src/objects/map-inl.h" | |
@@ -224,6 +226,11 @@ class EscapeAnalysisTracker : public ZoneObject { | |||
| 224 | 226 | return tracker_->ResolveReplacement( | |
| 225 | 227 | NodeProperties::GetContextInput(current_node())); | |
| 226 | 228 | } | |
| 229 | + // Accessing the current node is fine for `FrameState nodes. | ||
| 230 | + Node* CurrentNode() { | ||
| 231 | + DCHECK_EQ(current_node()->opcode(), IrOpcode::kFrameState); | ||
| 232 | + return current_node(); | ||
| 233 | + } | ||
| 227 | 234 | ||
| 228 | 235 | void SetReplacement(Node* replacement) { | |
| 229 | 236 | replacement_ = replacement; | |
@@ -799,9 +806,25 @@ void ReduceNode(const Operator* op, EscapeAnalysisTracker::Scope* current, | |||
| 799 | 806 | break; | |
| 800 | 807 | } | |
| 801 | 808 | case IrOpcode::kStateValues: | |
| 802 | - case IrOpcode::kFrameState: | ||
| 803 | 809 | // These uses are always safe. | |
| 804 | 810 | break; | |
| 811 | + case IrOpcode::kFrameState: { | ||
| 812 | + // We mark the receiver as escaping due to the non-standard `.getThis` | ||
| 813 | + // API. | ||
| 814 | + FrameState frame_state{current->CurrentNode()}; | ||
| 815 | + if (frame_state.frame_state_info().type() != | ||
| 816 | + FrameStateType::kUnoptimizedFunction) | ||
| 817 | + break; | ||
| 818 | + StateValuesAccess::iterator it = | ||
| 819 | + StateValuesAccess(frame_state.parameters()).begin(); | ||
| 820 | + if (!it.done()) { | ||
| 821 | + if (Node* receiver = it.node()) { | ||
| 822 | + current->SetEscaped(receiver); | ||
| 823 | + } | ||
| 824 | + current->SetEscaped(frame_state.function()); | ||
| 825 | + } | ||
| 826 | + break; | ||
| 827 | + } | ||
| 805 | 828 | default: { | |
| 806 | 829 | // For unknown nodes, treat all value inputs as escaping. | |
| 807 | 830 | int value_input_count = op->ValueInputCount(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -727,16 +727,14 @@ class LiftoffCompiler { | |||
| 727 | 727 | } | |
| 728 | 728 | ||
| 729 | 729 | void TierupCheck(FullDecoder* decoder, WasmCodePosition position, | |
| 730 | - int budget_used, Register scratch_reg) { | ||
| 730 | + int budget_used) { | ||
| 731 | 731 | if (for_debugging_ != kNoDebugging) return; | |
| 732 | 732 | CODE_COMMENT("tierup check"); | |
| 733 | 733 | // We never want to blow the entire budget at once. | |
| 734 | 734 | const int kMax = FLAG_wasm_tiering_budget / 4; | |
| 735 | 735 | if (budget_used > kMax) budget_used = kMax; | |
| 736 | 736 | ||
| 737 | - LiftoffRegister budget_reg = scratch_reg == no_reg | ||
| 738 | - ? __ GetUnusedRegister(kGpReg, {}) | ||
| 739 | - : LiftoffRegister(scratch_reg); | ||
| 737 | + LiftoffRegister budget_reg = __ GetUnusedRegister(kGpReg, {}); | ||
| 740 | 738 | __ Fill(budget_reg, liftoff::kTierupBudgetOffset, ValueKind::kI32); | |
| 741 | 739 | LiftoffRegList regs_to_save = __ cache_state()->used_registers; | |
| 742 | 740 | // The cached instance will be reloaded separately. | |
@@ -2241,7 +2239,8 @@ class LiftoffCompiler { | |||
| 2241 | 2239 | ||
| 2242 | 2240 | void TierupCheckOnExit(FullDecoder* decoder) { | |
| 2243 | 2241 | if (!dynamic_tiering()) return; | |
| 2244 | - TierupCheck(decoder, decoder->position(), __ pc_offset(), no_reg); | ||
| 2242 | + TierupCheck(decoder, decoder->position(), __ pc_offset()); | ||
| 2243 | + CODE_COMMENT("update tiering budget"); | ||
| 2245 | 2244 | LiftoffRegList pinned; | |
| 2246 | 2245 | LiftoffRegister budget = pinned.set(__ GetUnusedRegister(kGpReg, pinned)); | |
| 2247 | 2246 | LiftoffRegister array = pinned.set(__ GetUnusedRegister(kGpReg, pinned)); | |
@@ -2586,12 +2585,12 @@ class LiftoffCompiler { | |||
| 2586 | 2585 | __ PushRegister(kind, dst); | |
| 2587 | 2586 | } | |
| 2588 | 2587 | ||
| 2589 | - void BrImpl(FullDecoder* decoder, Control* target, Register scratch_reg) { | ||
| 2588 | + void BrImpl(FullDecoder* decoder, Control* target) { | ||
| 2590 | 2589 | if (dynamic_tiering()) { | |
| 2591 | 2590 | if (target->is_loop()) { | |
| 2592 | 2591 | DCHECK(target->label.get()->is_bound()); | |
| 2593 | 2592 | int jump_distance = __ pc_offset() - target->label.get()->pos(); | |
| 2594 | - TierupCheck(decoder, decoder->position(), jump_distance, scratch_reg); | ||
| 2593 | + TierupCheck(decoder, decoder->position(), jump_distance); | ||
| 2595 | 2594 | } else { | |
| 2596 | 2595 | // To estimate time spent in this function more accurately, we could | |
| 2597 | 2596 | // increment the tiering budget on forward jumps. However, we don't | |
@@ -2612,14 +2611,14 @@ class LiftoffCompiler { | |||
| 2612 | 2611 | ||
| 2613 | 2612 | void BrOrRet(FullDecoder* decoder, uint32_t depth, | |
| 2614 | 2613 | uint32_t /* drop_values */) { | |
| 2615 | - BrOrRetImpl(decoder, depth, no_reg); | ||
| 2614 | + BrOrRetImpl(decoder, depth); | ||
| 2616 | 2615 | } | |
| 2617 | 2616 | ||
| 2618 | - void BrOrRetImpl(FullDecoder* decoder, uint32_t depth, Register scratch_reg) { | ||
| 2617 | + void BrOrRetImpl(FullDecoder* decoder, uint32_t depth) { | ||
| 2619 | 2618 | if (depth == decoder->control_depth() - 1) { | |
| 2620 | 2619 | DoReturn(decoder, 0); | |
| 2621 | 2620 | } else { | |
| 2622 | - BrImpl(decoder, decoder->control_at(depth), scratch_reg); | ||
| 2621 | + BrImpl(decoder, decoder->control_at(depth)); | ||
| 2623 | 2622 | } | |
| 2624 | 2623 | } | |
| 2625 | 2624 | ||
@@ -2632,16 +2631,26 @@ class LiftoffCompiler { | |||
| 2632 | 2631 | decoder->control_at(depth)->br_merge()->arity); | |
| 2633 | 2632 | } | |
| 2634 | 2633 | ||
| 2635 | - Register scratch_reg = no_reg; | ||
| 2636 | - if (dynamic_tiering()) { | ||
| 2637 | - scratch_reg = __ GetUnusedRegister(kGpReg, {}).gp(); | ||
| 2638 | - } | ||
| 2639 | 2634 | Label cont_false; | |
| 2640 | 2635 | ||
| 2641 | 2636 | // Test the condition on the value stack, jump to {cont_false} if zero. | |
| 2642 | 2637 | JumpIfFalse(decoder, &cont_false); | |
| 2643 | 2638 | ||
| 2644 | - BrOrRetImpl(decoder, depth, scratch_reg); | ||
| 2639 | + // As a quickfix for https://crbug.com/1314184 we store the cache state | ||
| 2640 | + // before calling {BrOrRetImpl} under dynamic tiering, because the tier up | ||
| 2641 | + // check modifies the cache state (GetUnusedRegister, | ||
| 2642 | + // LoadInstanceIntoRegister). | ||
| 2643 | + // TODO(wasm): This causes significant overhead during compilation; try to | ||
| 2644 | + // avoid this, maybe by passing in scratch registers. | ||
| 2645 | + if (dynamic_tiering()) { | ||
| 2646 | + LiftoffAssembler::CacheState old_cache_state; | ||
| 2647 | + old_cache_state.Split(*__ cache_state()); | ||
| 2648 | + BrOrRetImpl(decoder, depth); | ||
| 2649 | + __ cache_state()->Steal(old_cache_state); | ||
| 2650 | + } else { | ||
| 2651 | + BrOrRetImpl(decoder, depth); | ||
| 2652 | + } | ||
| 2653 | + | ||
| 2645 | 2654 | __ bind(&cont_false); | |
| 2646 | 2655 | } | |
| 2647 | 2656 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments