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

Side by Side Diff: src/code-stubs-hydrogen.cc

Issue 2068693003: [stubs] Ensure that StoreTransitionStub does not bailout after the properties backing store is enla… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | src/crankshaft/hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/crankshaft/hydrogen.h" 8 #include "src/crankshaft/hydrogen.h"
9 #include "src/crankshaft/lithium.h" 9 #include "src/crankshaft/lithium.h"
10 #include "src/field-index.h" 10 #include "src/field-index.h"
(...skipping 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 return GetParameter(2); 1356 return GetParameter(2);
1357 } 1357 }
1358 1358
1359 1359
1360 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); } 1360 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); }
1361 1361
1362 1362
1363 template <> 1363 template <>
1364 HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() { 1364 HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() {
1365 HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex()); 1365 HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex());
1366 HValue* value = GetParameter(StoreTransitionHelper::ValueIndex());
1367 StoreTransitionStub::StoreMode store_mode = casted_stub()->store_mode();
1366 1368
1367 switch (casted_stub()->store_mode()) { 1369 if (store_mode != StoreTransitionStub::StoreMapOnly) {
1370 value = GetParameter(StoreTransitionHelper::ValueIndex());
1371 Representation representation = casted_stub()->representation();
1372 if (representation.IsDouble()) {
1373 // In case we are storing a double, assure that the value is a double
1374 // before manipulating the properties backing store. Otherwise the actual
1375 // store may deopt, leaving the backing store in an overallocated state.
1376 value = AddUncasted<HForceRepresentation>(value, representation);
1377 }
1378 }
1379
1380 switch (store_mode) {
1368 case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: { 1381 case StoreTransitionStub::ExtendStorageAndStoreMapAndValue: {
1369 HValue* properties = Add<HLoadNamedField>( 1382 HValue* properties = Add<HLoadNamedField>(
1370 object, nullptr, HObjectAccess::ForPropertiesPointer()); 1383 object, nullptr, HObjectAccess::ForPropertiesPointer());
1371 HValue* length = AddLoadFixedArrayLength(properties); 1384 HValue* length = AddLoadFixedArrayLength(properties);
1372 HValue* delta = 1385 HValue* delta =
1373 Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded)); 1386 Add<HConstant>(static_cast<int32_t>(JSObject::kFieldsAdded));
1374 HValue* new_capacity = AddUncasted<HAdd>(length, delta); 1387 HValue* new_capacity = AddUncasted<HAdd>(length, delta);
1375 1388
1376 // Grow properties array. 1389 // Grow properties array.
1377 ElementsKind kind = FAST_ELEMENTS; 1390 ElementsKind kind = FAST_ELEMENTS;
1378 Add<HBoundsCheck>(new_capacity, 1391 Add<HBoundsCheck>(new_capacity,
1379 Add<HConstant>((Page::kMaxRegularHeapObjectSize - 1392 Add<HConstant>((Page::kMaxRegularHeapObjectSize -
1380 FixedArray::kHeaderSize) >> 1393 FixedArray::kHeaderSize) >>
1381 ElementsKindToShiftSize(kind))); 1394 ElementsKindToShiftSize(kind)));
1382 1395
1383 // Reuse this code for properties backing store allocation. 1396 // Reuse this code for properties backing store allocation.
1384 HValue* new_properties = 1397 HValue* new_properties =
1385 BuildAllocateAndInitializeArray(kind, new_capacity); 1398 BuildAllocateAndInitializeArray(kind, new_capacity);
1386 1399
1387 BuildCopyProperties(properties, new_properties, length, new_capacity); 1400 BuildCopyProperties(properties, new_properties, length, new_capacity);
1388 1401
1389 Add<HStoreNamedField>(object, HObjectAccess::ForPropertiesPointer(), 1402 Add<HStoreNamedField>(object, HObjectAccess::ForPropertiesPointer(),
1390 new_properties); 1403 new_properties);
1391 } 1404 }
1392 // Fall through. 1405 // Fall through.
1393 case StoreTransitionStub::StoreMapAndValue: 1406 case StoreTransitionStub::StoreMapAndValue:
1394 // Store the new value into the "extended" object. 1407 // Store the new value into the "extended" object.
1395 BuildStoreNamedField( 1408 BuildStoreNamedField(object, value, casted_stub()->index(),
1396 object, GetParameter(StoreTransitionHelper::ValueIndex()), 1409 casted_stub()->representation(), true);
1397 casted_stub()->index(), casted_stub()->representation(), true);
1398 // Fall through. 1410 // Fall through.
1399 1411
1400 case StoreTransitionStub::StoreMapOnly: 1412 case StoreTransitionStub::StoreMapOnly:
1401 // And finally update the map. 1413 // And finally update the map.
1402 Add<HStoreNamedField>(object, HObjectAccess::ForMap(), 1414 Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
1403 GetParameter(StoreTransitionHelper::MapIndex())); 1415 GetParameter(StoreTransitionHelper::MapIndex()));
1404 break; 1416 break;
1405 } 1417 }
1406 return GetParameter(StoreTransitionHelper::ValueIndex()); 1418 return value;
1407 } 1419 }
1408 1420
1409 1421
1410 Handle<Code> StoreTransitionStub::GenerateCode() { 1422 Handle<Code> StoreTransitionStub::GenerateCode() {
1411 return DoGenerateCode(this); 1423 return DoGenerateCode(this);
1412 } 1424 }
1413 1425
1414 1426
1415 template <> 1427 template <>
1416 HValue* CodeStubGraphBuilder<StoreFastElementStub>::BuildCodeStub() { 1428 HValue* CodeStubGraphBuilder<StoreFastElementStub>::BuildCodeStub() {
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 return Pop(); 2312 return Pop();
2301 } 2313 }
2302 2314
2303 2315
2304 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2316 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2305 return DoGenerateCode(this); 2317 return DoGenerateCode(this);
2306 } 2318 }
2307 2319
2308 } // namespace internal 2320 } // namespace internal
2309 } // namespace v8 2321 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698