File tree Expand file tree Collapse file tree 5 files changed +66
-6
lines changed
Expand file tree Collapse file tree 5 files changed +66
-6
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,7 @@ class BasicBlock {
262262 bool is_exception_handler_block () const {
263263 return has_state () && state_->is_exception_handler ();
264264 }
265+ bool is_inline () const { return has_state () && state_->is_inline (); }
265266
266267 // If the basic block is an empty (unnecessary) block containing only an
267268 // unconditional jump to the successor block, return the successor block.
Original file line number Diff line number Diff line change @@ -148,7 +148,8 @@ MergePointInterpreterFrameState::MergePointInterpreterFrameState(
148148 : merge_offset_(merge_offset),
149149 predecessor_count_ (predecessor_count),
150150 predecessors_so_far_(predecessors_so_far),
151- bitfield_(kBasicBlockTypeBits ::encode(type)),
151+ bitfield_(kBasicBlockTypeBits ::encode(type) |
152+ kIsInline::encode(info.is_inline())),
152153 predecessors_(predecessors),
153154 frame_state_(info, liveness),
154155 per_predecessor_alternatives_(
Original file line number Diff line number Diff line change @@ -465,6 +465,8 @@ class MergePointInterpreterFrameState {
465465 basic_block_type () == BasicBlockType::kUnusedExceptionHandlerStart ;
466466 }
467467
468+ bool is_inline () const { return kIsInline::decode (bitfield_); }
469+
468470 bool is_unmerged_loop () const {
469471 // If this is a loop and not all predecessors are set, then the loop isn't
470472 // merged yet.
@@ -518,6 +520,7 @@ class MergePointInterpreterFrameState {
518520 using kBasicBlockTypeBits = base::BitField<BasicBlockType, 0 , 2 >;
519521 using kIsResumableLoopBit = kBasicBlockTypeBits ::Next<bool , 1 >;
520522 using kIsLoopWithPeeledIterationBit = kIsResumableLoopBit ::Next<bool , 1 >;
523+ using kIsInline = kIsLoopWithPeeledIterationBit ::Next<bool , 1 >;
521524
522525 // For each non-Phi value in the frame state, store its alternative
523526 // representations to avoid re-converting on Phi creation.
Original file line number Diff line number Diff line change @@ -520,17 +520,17 @@ void StraightForwardRegisterAllocator::AllocateRegisters() {
520520 }
521521 }
522522 } else if (phi->owner ().is_parameter () &&
523- phi->owner ().is_receiver ()) {
523+ phi->owner ().is_receiver () && !block-> is_inline () ) {
524524 // The receiver is a special case for a fairly silly reason:
525525 // OptimizedJSFrame::Summarize requires the receiver (and the
526526 // function) to be in a stack slot, since its value must be
527527 // available even though we're not deoptimizing (and thus register
528528 // states are not available).
529529 //
530- // TODO(leszeks):
531- // For inlined functions / nested graph generation, this a) doesn't
532- // work (there's no receiver stack slot); and b) isn't necessary
533- // (Summarize only looks at noninlined functions).
530+ // Note that this is skipped for inlined functions / nested graph
531+ // generation, since this a) wouldn't work (there's no receiver
532+ // stack slot); and b) isn't necessary (Summarize only looks at
533+ // noninlined functions).
534534 phi->regalloc_info ()->Spill (compiler::AllocatedOperand (
535535 compiler::AllocatedOperand::STACK_SLOT,
536536 MachineRepresentation::kTagged ,
Original file line number Diff line number Diff line change 1+ // Copyright 2025 the V8 project authors. All rights reserved.
2+ // Use of this source code is governed by a BSD-style license that can be
3+ // found in the LICENSE file.
4+
5+ // Flags: --allow-natives-syntax
6+
7+ ( function ( ) {
8+ const handler = {
9+ get : function ( ) {
10+ return __dummy ;
11+ }
12+ } ;
13+ __dummy = new Proxy ( function ( ) {
14+ } , handler ) ;
15+ Object . freeze ( __dummy ) ;
16+ } ) ( ) ;
17+
18+ function __wrapTC ( ) {
19+ return __dummy ;
20+ }
21+
22+
23+ let caught = 0 ;
24+
25+ class C1 {
26+ constructor ( x ) {
27+ return x ;
28+ }
29+ }
30+ class C2 extends C1 {
31+ field = ( ( ) => { } ) ( ) ;
32+ constructor ( x ) {
33+ try {
34+ super ( x ) ;
35+ } catch ( e ) {
36+ }
37+ }
38+ }
39+ function foo ( ) {
40+ let x = __wrapTC ( ) ;
41+ new C2 ( x ) ;
42+ try {
43+ this . test ( ) ;
44+ } catch ( e ) {
45+ return 42 ;
46+ }
47+ }
48+
49+ % PrepareFunctionForOptimization ( foo ) ;
50+ % PrepareFunctionForOptimization ( C2 ) ;
51+ assertEquals ( 42 , foo ( ) ) ;
52+ assertEquals ( 42 , foo ( ) ) ;
53+
54+ % OptimizeMaglevOnNextCall ( foo ) ;
55+ assertEquals ( 42 , foo ( ) ) ;
You can’t perform that action at this time.
0 commit comments