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

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

Issue 900223002: Revert of Externalize deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/assembler.cc ('k') | src/deoptimizer.h » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/field-index.h" 9 #include "src/field-index.h"
10 #include "src/hydrogen.h" 10 #include "src/hydrogen.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 UNIMPLEMENTED(); 221 UNIMPLEMENTED();
222 return NULL; 222 return NULL;
223 } 223 }
224 224
225 virtual HValue* BuildCodeUninitializedStub() { 225 virtual HValue* BuildCodeUninitializedStub() {
226 // Force a deopt that falls back to the runtime. 226 // Force a deopt that falls back to the runtime.
227 HValue* undefined = graph()->GetConstantUndefined(); 227 HValue* undefined = graph()->GetConstantUndefined();
228 IfBuilder builder(this); 228 IfBuilder builder(this);
229 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined); 229 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined);
230 builder.Then(); 230 builder.Then();
231 builder.ElseDeopt(Deoptimizer::kForcedDeoptToRuntime); 231 builder.ElseDeopt("Forced deopt to runtime");
232 return undefined; 232 return undefined;
233 } 233 }
234 234
235 Stub* casted_stub() { return static_cast<Stub*>(stub()); } 235 Stub* casted_stub() { return static_cast<Stub*>(stub()); }
236 }; 236 };
237 237
238 238
239 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode( 239 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(
240 ExternalReference miss) { 240 ExternalReference miss) {
241 Factory* factory = isolate()->factory(); 241 Factory* factory = isolate()->factory();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 if_fixed.Else(); 363 if_fixed.Else();
364 Push(BuildCloneShallowArrayNonEmpty(boilerplate, 364 Push(BuildCloneShallowArrayNonEmpty(boilerplate,
365 allocation_site, 365 allocation_site,
366 alloc_site_mode, 366 alloc_site_mode,
367 FAST_DOUBLE_ELEMENTS)); 367 FAST_DOUBLE_ELEMENTS));
368 if_fixed.End(); 368 if_fixed.End();
369 if_fixed_cow.End(); 369 if_fixed_cow.End();
370 zero_capacity.End(); 370 zero_capacity.End();
371 371
372 checker.ElseDeopt(Deoptimizer::kUninitializedBoilerplateLiterals); 372 checker.ElseDeopt("Uninitialized boilerplate literals");
373 checker.End(); 373 checker.End();
374 374
375 return environment()->Pop(); 375 return environment()->Pop();
376 } 376 }
377 377
378 378
379 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { 379 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
380 return DoGenerateCode(this); 380 return DoGenerateCode(this);
381 } 381 }
382 382
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 Add<HLoadNamedField>(boilerplate, nullptr, access)); 429 Add<HLoadNamedField>(boilerplate, nullptr, access));
430 } 430 }
431 431
432 DCHECK(FLAG_allocation_site_pretenuring || (size == object_size)); 432 DCHECK(FLAG_allocation_site_pretenuring || (size == object_size));
433 if (FLAG_allocation_site_pretenuring) { 433 if (FLAG_allocation_site_pretenuring) {
434 BuildCreateAllocationMemento( 434 BuildCreateAllocationMemento(
435 object, Add<HConstant>(object_size), allocation_site); 435 object, Add<HConstant>(object_size), allocation_site);
436 } 436 }
437 437
438 environment()->Push(object); 438 environment()->Push(object);
439 checker.ElseDeopt(Deoptimizer::kUninitializedBoilerplateInFastClone); 439 checker.ElseDeopt("Uninitialized boilerplate in fast clone");
440 checker.End(); 440 checker.End();
441 441
442 return environment()->Pop(); 442 return environment()->Pop();
443 } 443 }
444 444
445 445
446 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { 446 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
447 return DoGenerateCode(this); 447 return DoGenerateCode(this);
448 } 448 }
449 449
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 HValue* backing_store_length = Add<HLoadNamedField>( 662 HValue* backing_store_length = Add<HLoadNamedField>(
663 backing_store, nullptr, HObjectAccess::ForFixedArrayLength()); 663 backing_store, nullptr, HObjectAccess::ForFixedArrayLength());
664 IfBuilder in_unmapped_range(this); 664 IfBuilder in_unmapped_range(this);
665 in_unmapped_range.If<HCompareNumericAndBranch>(key, backing_store_length, 665 in_unmapped_range.If<HCompareNumericAndBranch>(key, backing_store_length,
666 Token::LT); 666 Token::LT);
667 in_unmapped_range.Then(); 667 in_unmapped_range.Then();
668 { 668 {
669 result = Add<HLoadKeyed>(backing_store, key, nullptr, FAST_HOLEY_ELEMENTS, 669 result = Add<HLoadKeyed>(backing_store, key, nullptr, FAST_HOLEY_ELEMENTS,
670 NEVER_RETURN_HOLE); 670 NEVER_RETURN_HOLE);
671 } 671 }
672 in_unmapped_range.ElseDeopt(Deoptimizer::kOutsideOfRange); 672 in_unmapped_range.ElseDeopt("Outside of range");
673 in_unmapped_range.End(); 673 in_unmapped_range.End();
674 return result; 674 return result;
675 } 675 }
676 676
677 677
678 template <> 678 template <>
679 HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() { 679 HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() {
680 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); 680 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
681 HValue* key = GetParameter(LoadDescriptor::kNameIndex); 681 HValue* key = GetParameter(LoadDescriptor::kNameIndex);
682 682
(...skipping 20 matching lines...) Expand all
703 // 703 //
704 // Otherwise, t = elements[key + 2]. If t is the hole, then look up the value 704 // Otherwise, t = elements[key + 2]. If t is the hole, then look up the value
705 // in the unmapped arguments array, as described above. Otherwise, t is a Smi 705 // in the unmapped arguments array, as described above. Otherwise, t is a Smi
706 // index into the context array given at elements[0]. Return the value at 706 // index into the context array given at elements[0]. Return the value at
707 // context[t]. 707 // context[t].
708 708
709 key = AddUncasted<HForceRepresentation>(key, Representation::Smi()); 709 key = AddUncasted<HForceRepresentation>(key, Representation::Smi());
710 IfBuilder positive_smi(this); 710 IfBuilder positive_smi(this);
711 positive_smi.If<HCompareNumericAndBranch>(key, graph()->GetConstant0(), 711 positive_smi.If<HCompareNumericAndBranch>(key, graph()->GetConstant0(),
712 Token::LT); 712 Token::LT);
713 positive_smi.ThenDeopt(Deoptimizer::kKeyIsNegative); 713 positive_smi.ThenDeopt("key is negative");
714 positive_smi.End(); 714 positive_smi.End();
715 715
716 HValue* constant_two = Add<HConstant>(2); 716 HValue* constant_two = Add<HConstant>(2);
717 HValue* elements = AddLoadElements(receiver, nullptr); 717 HValue* elements = AddLoadElements(receiver, nullptr);
718 HValue* elements_length = Add<HLoadNamedField>( 718 HValue* elements_length = Add<HLoadNamedField>(
719 elements, nullptr, HObjectAccess::ForFixedArrayLength()); 719 elements, nullptr, HObjectAccess::ForFixedArrayLength());
720 HValue* adjusted_length = AddUncasted<HSub>(elements_length, constant_two); 720 HValue* adjusted_length = AddUncasted<HSub>(elements_length, constant_two);
721 IfBuilder in_range(this); 721 IfBuilder in_range(this);
722 in_range.If<HCompareNumericAndBranch>(key, adjusted_length, Token::LT); 722 in_range.If<HCompareNumericAndBranch>(key, adjusted_length, Token::LT);
723 in_range.Then(); 723 in_range.Then();
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 HValue* global = 1354 HValue* global =
1355 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype()); 1355 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype());
1356 Handle<Map> placeholder_map = isolate()->factory()->meta_map(); 1356 Handle<Map> placeholder_map = isolate()->factory()->meta_map();
1357 HValue* cell = Add<HConstant>(Map::WeakCellForMap(placeholder_map)); 1357 HValue* cell = Add<HConstant>(Map::WeakCellForMap(placeholder_map));
1358 HValue* expected_map = 1358 HValue* expected_map =
1359 Add<HLoadNamedField>(cell, nullptr, HObjectAccess::ForWeakCellValue()); 1359 Add<HLoadNamedField>(cell, nullptr, HObjectAccess::ForWeakCellValue());
1360 HValue* map = 1360 HValue* map =
1361 Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap()); 1361 Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap());
1362 IfBuilder map_check(this); 1362 IfBuilder map_check(this);
1363 map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map); 1363 map_check.IfNot<HCompareObjectEqAndBranch>(expected_map, map);
1364 map_check.ThenDeopt(Deoptimizer::kUnknownMap); 1364 map_check.ThenDeopt("Unknown map");
1365 map_check.End(); 1365 map_check.End();
1366 } 1366 }
1367 1367
1368 HValue* weak_cell = Add<HConstant>(isolate()->factory()->NewWeakCell( 1368 HValue* weak_cell = Add<HConstant>(isolate()->factory()->NewWeakCell(
1369 StoreGlobalStub::property_cell_placeholder(isolate()))); 1369 StoreGlobalStub::property_cell_placeholder(isolate())));
1370 HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr, 1370 HValue* cell = Add<HLoadNamedField>(weak_cell, nullptr,
1371 HObjectAccess::ForWeakCellValue()); 1371 HObjectAccess::ForWeakCellValue());
1372 HObjectAccess access(HObjectAccess::ForCellPayload(isolate())); 1372 HObjectAccess access(HObjectAccess::ForCellPayload(isolate()));
1373 HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access); 1373 HValue* cell_contents = Add<HLoadNamedField>(cell, nullptr, access);
1374 1374
1375 if (stub->is_constant()) { 1375 if (stub->is_constant()) {
1376 IfBuilder builder(this); 1376 IfBuilder builder(this);
1377 builder.If<HCompareObjectEqAndBranch>(cell_contents, value); 1377 builder.If<HCompareObjectEqAndBranch>(cell_contents, value);
1378 builder.Then(); 1378 builder.Then();
1379 builder.ElseDeopt( 1379 builder.ElseDeopt("Unexpected cell contents in constant global store");
1380 Deoptimizer::kUnexpectedCellContentsInConstantGlobalStore);
1381 builder.End(); 1380 builder.End();
1382 } else { 1381 } else {
1383 // Load the payload of the global parameter cell. A hole indicates that the 1382 // Load the payload of the global parameter cell. A hole indicates that the
1384 // property has been deleted and that the store must be handled by the 1383 // property has been deleted and that the store must be handled by the
1385 // runtime. 1384 // runtime.
1386 IfBuilder builder(this); 1385 IfBuilder builder(this);
1387 HValue* hole_value = graph()->GetConstantHole(); 1386 HValue* hole_value = graph()->GetConstantHole();
1388 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value); 1387 builder.If<HCompareObjectEqAndBranch>(cell_contents, hole_value);
1389 builder.Then(); 1388 builder.Then();
1390 builder.Deopt(Deoptimizer::kUnexpectedCellContentsInGlobalStore); 1389 builder.Deopt("Unexpected cell contents in global store");
1391 builder.Else(); 1390 builder.Else();
1392 HStoreNamedField* store = Add<HStoreNamedField>(cell, access, value); 1391 HStoreNamedField* store = Add<HStoreNamedField>(cell, access, value);
1393 store->MarkReceiverAsCell(); 1392 store->MarkReceiverAsCell();
1394 builder.End(); 1393 builder.End();
1395 } 1394 }
1396 1395
1397 return value; 1396 return value;
1398 } 1397 }
1399 1398
1400 1399
1401 Handle<Code> StoreGlobalStub::GenerateCode() { 1400 Handle<Code> StoreGlobalStub::GenerateCode() {
1402 return DoGenerateCode(this); 1401 return DoGenerateCode(this);
1403 } 1402 }
1404 1403
1405 1404
1406 template<> 1405 template<>
1407 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { 1406 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
1408 HValue* value = GetParameter(ElementsTransitionAndStoreStub::kValueIndex); 1407 HValue* value = GetParameter(ElementsTransitionAndStoreStub::kValueIndex);
1409 HValue* map = GetParameter(ElementsTransitionAndStoreStub::kMapIndex); 1408 HValue* map = GetParameter(ElementsTransitionAndStoreStub::kMapIndex);
1410 HValue* key = GetParameter(ElementsTransitionAndStoreStub::kKeyIndex); 1409 HValue* key = GetParameter(ElementsTransitionAndStoreStub::kKeyIndex);
1411 HValue* object = GetParameter(ElementsTransitionAndStoreStub::kObjectIndex); 1410 HValue* object = GetParameter(ElementsTransitionAndStoreStub::kObjectIndex);
1412 1411
1413 if (FLAG_trace_elements_transitions) { 1412 if (FLAG_trace_elements_transitions) {
1414 // Tracing elements transitions is the job of the runtime. 1413 // Tracing elements transitions is the job of the runtime.
1415 Add<HDeoptimize>(Deoptimizer::kTracingElementsTransitions, 1414 Add<HDeoptimize>("Tracing elements transitions", Deoptimizer::EAGER);
1416 Deoptimizer::EAGER);
1417 } else { 1415 } else {
1418 info()->MarkAsSavesCallerDoubles(); 1416 info()->MarkAsSavesCallerDoubles();
1419 1417
1420 BuildTransitionElementsKind(object, map, 1418 BuildTransitionElementsKind(object, map,
1421 casted_stub()->from_kind(), 1419 casted_stub()->from_kind(),
1422 casted_stub()->to_kind(), 1420 casted_stub()->to_kind(),
1423 casted_stub()->is_jsarray()); 1421 casted_stub()->is_jsarray());
1424 1422
1425 BuildUncheckedMonomorphicElementAccess(object, key, value, 1423 BuildUncheckedMonomorphicElementAccess(object, key, value,
1426 casted_stub()->is_jsarray(), 1424 casted_stub()->is_jsarray(),
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 HValue* hash = BuildElementIndexHash(key); 1867 HValue* hash = BuildElementIndexHash(key);
1870 1868
1871 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash)); 1869 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash));
1872 } 1870 }
1873 kind_if.Else(); 1871 kind_if.Else();
1874 1872
1875 // The SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" 1873 // The SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then"
1876 BuildElementsKindLimitCheck(&kind_if, bit_field2, 1874 BuildElementsKindLimitCheck(&kind_if, bit_field2,
1877 SLOPPY_ARGUMENTS_ELEMENTS); 1875 SLOPPY_ARGUMENTS_ELEMENTS);
1878 // Non-strict elements are not handled. 1876 // Non-strict elements are not handled.
1879 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, 1877 Add<HDeoptimize>("non-strict elements in KeyedLoadGenericStub",
1880 Deoptimizer::EAGER); 1878 Deoptimizer::EAGER);
1881 Push(graph()->GetConstant0()); 1879 Push(graph()->GetConstant0());
1882 1880
1883 kind_if.Else(); 1881 kind_if.Else();
1884 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2, 1882 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
1885 EXTERNAL_INT8_ELEMENTS); 1883 EXTERNAL_INT8_ELEMENTS);
1886 1884
1887 kind_if.Else(); 1885 kind_if.Else();
1888 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2, 1886 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
1889 EXTERNAL_UINT8_ELEMENTS); 1887 EXTERNAL_UINT8_ELEMENTS);
(...skipping 19 matching lines...) Expand all
1909 EXTERNAL_FLOAT32_ELEMENTS); 1907 EXTERNAL_FLOAT32_ELEMENTS);
1910 1908
1911 kind_if.Else(); 1909 kind_if.Else();
1912 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2, 1910 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
1913 EXTERNAL_FLOAT64_ELEMENTS); 1911 EXTERNAL_FLOAT64_ELEMENTS);
1914 1912
1915 kind_if.Else(); 1913 kind_if.Else();
1916 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2, 1914 BuildExternalElementLoad(&kind_if, receiver, key, instance_type, bit_field2,
1917 EXTERNAL_UINT8_CLAMPED_ELEMENTS); 1915 EXTERNAL_UINT8_CLAMPED_ELEMENTS);
1918 1916
1919 kind_if.ElseDeopt( 1917 kind_if.ElseDeopt("ElementsKind unhandled in KeyedLoadGenericStub");
1920 Deoptimizer::kElementsKindUnhandledInKeyedLoadGenericStub);
1921 1918
1922 kind_if.End(); 1919 kind_if.End();
1923 } 1920 }
1924 index_name_split.Else(); 1921 index_name_split.Else();
1925 { 1922 {
1926 // Key is a unique string. 1923 // Key is a unique string.
1927 key = Pop(); 1924 key = Pop();
1928 1925
1929 int bit_field_mask = (1 << Map::kIsAccessCheckNeeded) | 1926 int bit_field_mask = (1 << Map::kIsAccessCheckNeeded) |
1930 (1 << Map::kHasNamedInterceptor); 1927 (1 << Map::kHasNamedInterceptor);
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 // megamorphic case is handled as part of the default stub. 2260 // megamorphic case is handled as part of the default stub.
2264 DCHECK(!FLAG_vector_ics); 2261 DCHECK(!FLAG_vector_ics);
2265 2262
2266 // Probe the stub cache. 2263 // Probe the stub cache.
2267 Add<HTailCallThroughMegamorphicCache>(receiver, name); 2264 Add<HTailCallThroughMegamorphicCache>(receiver, name);
2268 2265
2269 // We never continue. 2266 // We never continue.
2270 return graph()->GetConstant0(); 2267 return graph()->GetConstant0();
2271 } 2268 }
2272 } } // namespace v8::internal 2269 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698