| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a4c7c9f commit f77a96c
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ | |||
| 11 | 11 | #define V8_MAJOR_VERSION 13 | |
| 12 | 12 | #define V8_MINOR_VERSION 7 | |
| 13 | 13 | #define V8_BUILD_NUMBER 152 | |
| 14 | - #define V8_PATCH_LEVEL 9 | ||
| 14 | + #define V8_PATCH_LEVEL 10 | ||
| 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 | |
|---|---|---|---|
@@ -409,11 +409,17 @@ void LateLoadEliminationAnalyzer::ProcessStore(OpIndex op_idx, | |||
| 409 | 409 | non_aliasing_objects_.Set(value, false); | |
| 410 | 410 | } | |
| 411 | 411 | ||
| 412 | - // If we just stored a map, invalidate the maps for this base. | ||
| 412 | + // If we just stored a map, invalidate all object_maps_. | ||
| 413 | 413 | if (store.offset == HeapObject::kMapOffset && !store.index().valid()) { | |
| 414 | - if (object_maps_.HasKeyFor(store.base())) { | ||
| 415 | - TRACE(">> Wiping map\n"); | ||
| 416 | - object_maps_.Set(store.base(), MapMaskAndOr{}); | ||
| 414 | + // TODO(dmercadier): can we only do this for objects that are potentially | ||
| 415 | + // aliasing with the `base` (based on their maps and the maps of `base`)? | ||
| 416 | + // Also, it might be worth to record a new map if this is actually a map | ||
| 417 | + // store. | ||
| 418 | + // TODO(dmercadier): do this only if `value` is a Constant with kind | ||
| 419 | + // kHeapObject, since all map stores should store a known constant maps. | ||
| 420 | + TRACE(">> Wiping all maps\n"); | ||
| 421 | + for (auto it : object_maps_) { | ||
| 422 | + object_maps_.Set(it.second, MapMaskAndOr{}); | ||
| 417 | 423 | } | |
| 418 | 424 | } | |
| 419 | 425 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,9 @@ class SparseOpIndexSnapshotTable : public SnapshotTable<Value, KeyData> { | |||
| 60 | 60 | return std::nullopt; | |
| 61 | 61 | } | |
| 62 | 62 | ||
| 63 | + auto begin() { return indices_to_keys_.begin(); } | ||
| 64 | + auto end() { return indices_to_keys_.end(); } | ||
| 65 | + | ||
| 63 | 66 | private: | |
| 64 | 67 | Key GetOrCreateKey(OpIndex idx) { | |
| 65 | 68 | auto it = indices_to_keys_.find(idx); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,9 @@ | |||
| 18 | 18 | namespace v8::internal::compiler::turboshaft { | |
| 19 | 19 | ||
| 20 | 20 | void StoreStoreEliminationPhase::Run(PipelineData* data, Zone* temp_zone) { | |
| 21 | + UnparkedScopeIfNeeded unparked_scope( | ||
| 22 | + data->broker(), v8_flags.turboshaft_trace_load_elimination); | ||
| 23 | + | ||
| 21 | 24 | turboshaft::CopyingPhase< | |
| 22 | 25 | LoopStackCheckElisionReducer, StoreStoreEliminationReducer, | |
| 23 | 26 | LateLoadEliminationReducer, MachineOptimizationReducer, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1610,6 +1610,8 @@ DEFINE_BOOL_READONLY(turboshaft_trace_emitted, false, | |||
| 1610 | 1610 | "trace emitted Turboshaft instructions") | |
| 1611 | 1611 | DEFINE_BOOL_READONLY(turboshaft_trace_intermediate_reductions, false, | |
| 1612 | 1612 | "trace intermediate Turboshaft reduction steps") | |
| 1613 | + DEFINE_BOOL_READONLY(turboshaft_trace_load_elimination, false, | ||
| 1614 | + "trace Turboshaft's late load elimination") | ||
| 1613 | 1615 | #endif // DEBUG | |
| 1614 | 1616 | ||
| 1615 | 1617 | DEFINE_BOOL(profile_guided_optimization, true, "profile guided optimization") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,24 @@ | |||
| 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 --turbofan | ||
| 6 | + | ||
| 7 | + function foo(a, b, c) { | ||
| 8 | + a.x = 42; | ||
| 9 | + b.y = 99; // Transitioning store | ||
| 10 | + c.x = 17; | ||
| 11 | + return a.x; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + // Using a constructor so that we don't go out of object when creating the .y | ||
| 15 | + // property in foo. | ||
| 16 | + function MyObject() { this.x = 27; } | ||
| 17 | + let o1 = new MyObject(); | ||
| 18 | + let o2 = new MyObject(); | ||
| 19 | + | ||
| 20 | + %PrepareFunctionForOptimization(foo); | ||
| 21 | + assertEquals(17, foo(o1, o1, o1)); | ||
| 22 | + | ||
| 23 | + %OptimizeFunctionOnNextCall(foo); | ||
| 24 | + assertEquals(17, foo(o2, o2, o2)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 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 --turbofan | ||
| 6 | + | ||
| 7 | + function foo(a, b, c) { | ||
| 8 | + a.x = 42; | ||
| 9 | + b.y = 99; // Transitioning store | ||
| 10 | + c.x = 17; | ||
| 11 | + return a.x; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + let o1 = { x : 27 }; | ||
| 15 | + let o2 = { x : 27 }; | ||
| 16 | + | ||
| 17 | + %PrepareFunctionForOptimization(foo); | ||
| 18 | + assertEquals(17, foo(o1, o1, o1)); | ||
| 19 | + | ||
| 20 | + %OptimizeFunctionOnNextCall(foo); | ||
| 21 | + assertEquals(17, foo(o2, o2, o2)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 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 --turbofan | ||
| 6 | + | ||
| 7 | + function foo(a, b, c) { | ||
| 8 | + a.x = 42; | ||
| 9 | + b.y = 99; // Transitioning store | ||
| 10 | + c.x = 17; | ||
| 11 | + return a.x; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + let o1 = { x : 27 }; | ||
| 15 | + // If we add additional properties, we need to add at least 2 so that `b.y = 99` | ||
| 16 | + // doesn't end up at offset 12, because that's also the offset of .x (which is | ||
| 17 | + // in-object rather than out-of-object), and because we don't have map | ||
| 18 | + // information for backing stores in Late load elimination, we'll assume that | ||
| 19 | + // the store at b.y can alias with the a.x that was previously loaded. | ||
| 20 | + o1.unused1 = 12; | ||
| 21 | + o1.unused2 = 12; | ||
| 22 | + | ||
| 23 | + let o2 = { x : 27 }; | ||
| 24 | + o2.unused1 = 12; | ||
| 25 | + o2.unused2 = 12; | ||
| 26 | + | ||
| 27 | + %PrepareFunctionForOptimization(foo); | ||
| 28 | + assertEquals(17, foo(o1, o1, o1)); | ||
| 29 | + | ||
| 30 | + %OptimizeFunctionOnNextCall(foo); | ||
| 31 | + assertEquals(17, foo(o2, o2, o2)); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 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 --turbofan | ||
| 6 | + | ||
| 7 | + function opt() { | ||
| 8 | + const nop = 0; | ||
| 9 | + const empty = {}; | ||
| 10 | + const a = {p1: 42.42}; | ||
| 11 | + | ||
| 12 | + function foo(b) { | ||
| 13 | + nop; | ||
| 14 | + | ||
| 15 | + a.p4 = 42; | ||
| 16 | + b.p2 = 42; | ||
| 17 | + b.p5 = empty; | ||
| 18 | + a.p6 = 41.414; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + a.p3 = 42; | ||
| 22 | + a.p4 = 42; | ||
| 23 | + | ||
| 24 | + for (let i = 0; i < 300; i++) { | ||
| 25 | + foo(a); | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + opt(); | ||
| 30 | + opt(); | ||
| 31 | + opt(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments