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

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

Issue 143633007: A64: Synchronize with r18764. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.cc ('k') | src/codegen.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 316
317 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { 317 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) {
318 return DoGenerateCode(isolate, this); 318 return DoGenerateCode(isolate, this);
319 } 319 }
320 320
321 321
322 template <> 322 template <>
323 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { 323 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
324 info()->MarkAsSavesCallerDoubles(); 324 info()->MarkAsSavesCallerDoubles();
325 HValue* number = GetParameter(NumberToStringStub::kNumber); 325 HValue* number = GetParameter(NumberToStringStub::kNumber);
326 return BuildNumberToString(number, Type::Number(isolate())); 326 return BuildNumberToString(number, Type::Number(zone()));
327 } 327 }
328 328
329 329
330 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { 330 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) {
331 return DoGenerateCode(isolate, this); 331 return DoGenerateCode(isolate, this);
332 } 332 }
333 333
334 334
335 template <> 335 template <>
336 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 336 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 Handle<Code> TransitionElementsKindStub::GenerateCode(Isolate* isolate) { 646 Handle<Code> TransitionElementsKindStub::GenerateCode(Isolate* isolate) {
647 return DoGenerateCode(isolate, this); 647 return DoGenerateCode(isolate, this);
648 } 648 }
649 649
650 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( 650 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor(
651 ElementsKind kind, 651 ElementsKind kind,
652 AllocationSiteOverrideMode override_mode, 652 AllocationSiteOverrideMode override_mode,
653 ArgumentClass argument_class) { 653 ArgumentClass argument_class) {
654 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); 654 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor);
655 HValue* property_cell = GetParameter(ArrayConstructorStubBase::kPropertyCell); 655 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite);
656 // Walk through the property cell to the AllocationSite
657 HValue* alloc_site = Add<HLoadNamedField>(property_cell,
658 HObjectAccess::ForCellValue());
659 JSArrayBuilder array_builder(this, kind, alloc_site, constructor, 656 JSArrayBuilder array_builder(this, kind, alloc_site, constructor,
660 override_mode); 657 override_mode);
661 HValue* result = NULL; 658 HValue* result = NULL;
662 switch (argument_class) { 659 switch (argument_class) {
663 case NONE: 660 case NONE:
664 result = array_builder.AllocateEmptyArray(); 661 result = array_builder.AllocateEmptyArray();
665 break; 662 break;
666 case SINGLE: 663 case SINGLE:
667 result = BuildArraySingleArgumentConstructor(&array_builder); 664 result = BuildArraySingleArgumentConstructor(&array_builder);
668 break; 665 break;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 return DoGenerateCode(isolate, this); 834 return DoGenerateCode(isolate, this);
838 } 835 }
839 836
840 837
841 template <> 838 template <>
842 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { 839 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() {
843 Isolate* isolate = graph()->isolate(); 840 Isolate* isolate = graph()->isolate();
844 CompareNilICStub* stub = casted_stub(); 841 CompareNilICStub* stub = casted_stub();
845 HIfContinuation continuation; 842 HIfContinuation continuation;
846 Handle<Map> sentinel_map(isolate->heap()->meta_map()); 843 Handle<Map> sentinel_map(isolate->heap()->meta_map());
847 Handle<Type> type = stub->GetType(isolate, sentinel_map); 844 Type* type = stub->GetType(zone(), sentinel_map);
848 BuildCompareNil(GetParameter(0), type, &continuation); 845 BuildCompareNil(GetParameter(0), type, &continuation);
849 IfBuilder if_nil(this, &continuation); 846 IfBuilder if_nil(this, &continuation);
850 if_nil.Then(); 847 if_nil.Then();
851 if (continuation.IsFalseReachable()) { 848 if (continuation.IsFalseReachable()) {
852 if_nil.Else(); 849 if_nil.Else();
853 if_nil.Return(graph()->GetConstant0()); 850 if_nil.Return(graph()->GetConstant0());
854 } 851 }
855 if_nil.End(); 852 if_nil.End();
856 return continuation.IsTrueReachable() 853 return continuation.IsTrueReachable()
857 ? graph()->GetConstant1() 854 ? graph()->GetConstant1()
858 : graph()->GetConstantUndefined(); 855 : graph()->GetConstantUndefined();
859 } 856 }
860 857
861 858
862 Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) { 859 Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) {
863 return DoGenerateCode(isolate, this); 860 return DoGenerateCode(isolate, this);
864 } 861 }
865 862
866 863
867 template <> 864 template <>
868 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { 865 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
869 BinaryOpIC::State state = casted_stub()->state(); 866 BinaryOpIC::State state = casted_stub()->state();
870 867
871 HValue* left = GetParameter(BinaryOpICStub::kLeft); 868 HValue* left = GetParameter(BinaryOpICStub::kLeft);
872 HValue* right = GetParameter(BinaryOpICStub::kRight); 869 HValue* right = GetParameter(BinaryOpICStub::kRight);
873 870
874 Handle<Type> left_type = state.GetLeftType(isolate()); 871 Type* left_type = state.GetLeftType(zone());
875 Handle<Type> right_type = state.GetRightType(isolate()); 872 Type* right_type = state.GetRightType(zone());
876 Handle<Type> result_type = state.GetResultType(isolate()); 873 Type* result_type = state.GetResultType(zone());
877 874
878 ASSERT(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) && 875 ASSERT(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) &&
879 (state.HasSideEffects() || !result_type->Is(Type::None()))); 876 (state.HasSideEffects() || !result_type->Is(Type::None())));
880 877
881 HValue* result = NULL; 878 HValue* result = NULL;
882 HAllocationMode allocation_mode(NOT_TENURED); 879 HAllocationMode allocation_mode(NOT_TENURED);
883 if (state.op() == Token::ADD && 880 if (state.op() == Token::ADD &&
884 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && 881 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) &&
885 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { 882 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) {
886 // For the generic add stub a fast case for string addition is performance 883 // For the generic add stub a fast case for string addition is performance
887 // critical. 884 // critical.
888 if (left_type->Maybe(Type::String())) { 885 if (left_type->Maybe(Type::String())) {
889 IfBuilder if_leftisstring(this); 886 IfBuilder if_leftisstring(this);
890 if_leftisstring.If<HIsStringAndBranch>(left); 887 if_leftisstring.If<HIsStringAndBranch>(left);
891 if_leftisstring.Then(); 888 if_leftisstring.Then();
892 { 889 {
893 Push(BuildBinaryOperation( 890 Push(BuildBinaryOperation(
894 state.op(), left, right, 891 state.op(), left, right,
895 Type::String(isolate()), right_type, 892 Type::String(zone()), right_type,
896 result_type, state.fixed_right_arg(), 893 result_type, state.fixed_right_arg(),
897 allocation_mode)); 894 allocation_mode));
898 } 895 }
899 if_leftisstring.Else(); 896 if_leftisstring.Else();
900 { 897 {
901 Push(BuildBinaryOperation( 898 Push(BuildBinaryOperation(
902 state.op(), left, right, 899 state.op(), left, right,
903 left_type, right_type, result_type, 900 left_type, right_type, result_type,
904 state.fixed_right_arg(), allocation_mode)); 901 state.fixed_right_arg(), allocation_mode));
905 } 902 }
906 if_leftisstring.End(); 903 if_leftisstring.End();
907 result = Pop(); 904 result = Pop();
908 } else { 905 } else {
909 IfBuilder if_rightisstring(this); 906 IfBuilder if_rightisstring(this);
910 if_rightisstring.If<HIsStringAndBranch>(right); 907 if_rightisstring.If<HIsStringAndBranch>(right);
911 if_rightisstring.Then(); 908 if_rightisstring.Then();
912 { 909 {
913 Push(BuildBinaryOperation( 910 Push(BuildBinaryOperation(
914 state.op(), left, right, 911 state.op(), left, right,
915 left_type, Type::String(isolate()), 912 left_type, Type::String(zone()),
916 result_type, state.fixed_right_arg(), 913 result_type, state.fixed_right_arg(),
917 allocation_mode)); 914 allocation_mode));
918 } 915 }
919 if_rightisstring.Else(); 916 if_rightisstring.Else();
920 { 917 {
921 Push(BuildBinaryOperation( 918 Push(BuildBinaryOperation(
922 state.op(), left, right, 919 state.op(), left, right,
923 left_type, right_type, result_type, 920 left_type, right_type, result_type,
924 state.fixed_right_arg(), allocation_mode)); 921 state.fixed_right_arg(), allocation_mode));
925 } 922 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 976
980 template <> 977 template <>
981 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() { 978 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() {
982 BinaryOpIC::State state = casted_stub()->state(); 979 BinaryOpIC::State state = casted_stub()->state();
983 980
984 HValue* allocation_site = GetParameter( 981 HValue* allocation_site = GetParameter(
985 BinaryOpWithAllocationSiteStub::kAllocationSite); 982 BinaryOpWithAllocationSiteStub::kAllocationSite);
986 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft); 983 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft);
987 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight); 984 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight);
988 985
989 Handle<Type> left_type = state.GetLeftType(isolate()); 986 Type* left_type = state.GetLeftType(zone());
990 Handle<Type> right_type = state.GetRightType(isolate()); 987 Type* right_type = state.GetRightType(zone());
991 Handle<Type> result_type = state.GetResultType(isolate()); 988 Type* result_type = state.GetResultType(zone());
992 HAllocationMode allocation_mode(allocation_site); 989 HAllocationMode allocation_mode(allocation_site);
993 990
994 return BuildBinaryOperation(state.op(), left, right, 991 return BuildBinaryOperation(state.op(), left, right,
995 left_type, right_type, result_type, 992 left_type, right_type, result_type,
996 state.fixed_right_arg(), allocation_mode); 993 state.fixed_right_arg(), allocation_mode);
997 } 994 }
998 995
999 996
1000 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode(Isolate* isolate) { 997 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode(Isolate* isolate) {
1001 return DoGenerateCode(isolate, this); 998 return DoGenerateCode(isolate, this);
1002 } 999 }
1003 1000
1004 1001
1005 template <> 1002 template <>
1006 HValue* CodeStubGraphBuilder<NewStringAddStub>::BuildCodeInitializedStub() { 1003 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() {
1007 NewStringAddStub* stub = casted_stub(); 1004 StringAddStub* stub = casted_stub();
1008 StringAddFlags flags = stub->flags(); 1005 StringAddFlags flags = stub->flags();
1009 PretenureFlag pretenure_flag = stub->pretenure_flag(); 1006 PretenureFlag pretenure_flag = stub->pretenure_flag();
1010 1007
1011 HValue* left = GetParameter(NewStringAddStub::kLeft); 1008 HValue* left = GetParameter(StringAddStub::kLeft);
1012 HValue* right = GetParameter(NewStringAddStub::kRight); 1009 HValue* right = GetParameter(StringAddStub::kRight);
1013 1010
1014 // Make sure that both arguments are strings if not known in advance. 1011 // Make sure that both arguments are strings if not known in advance.
1015 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { 1012 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
1016 left = BuildCheckString(left); 1013 left = BuildCheckString(left);
1017 } 1014 }
1018 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { 1015 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) {
1019 right = BuildCheckString(right); 1016 right = BuildCheckString(right);
1020 } 1017 }
1021 1018
1022 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag)); 1019 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag));
1023 } 1020 }
1024 1021
1025 1022
1026 Handle<Code> NewStringAddStub::GenerateCode(Isolate* isolate) { 1023 Handle<Code> StringAddStub::GenerateCode(Isolate* isolate) {
1027 return DoGenerateCode(isolate, this); 1024 return DoGenerateCode(isolate, this);
1028 } 1025 }
1029 1026
1030 1027
1031 template <> 1028 template <>
1032 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { 1029 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
1033 ToBooleanStub* stub = casted_stub(); 1030 ToBooleanStub* stub = casted_stub();
1034 1031
1035 IfBuilder if_true(this); 1032 IfBuilder if_true(this);
1036 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); 1033 if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 return js_function; 1323 return js_function;
1327 } 1324 }
1328 1325
1329 1326
1330 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { 1327 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) {
1331 return DoGenerateCode(isolate, this); 1328 return DoGenerateCode(isolate, this);
1332 } 1329 }
1333 1330
1334 1331
1335 template<> 1332 template<>
1333 HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() {
1334 int length = casted_stub()->slots() + Context::MIN_CONTEXT_SLOTS;
1335
1336 // Get the function.
1337 HParameter* function = GetParameter(FastNewContextStub::kFunction);
1338
1339 // Allocate the context in new space.
1340 HAllocate* function_context = Add<HAllocate>(
1341 Add<HConstant>(length * kPointerSize + FixedArray::kHeaderSize),
1342 HType::Tagged(), NOT_TENURED, FIXED_ARRAY_TYPE);
1343
1344 // Set up the object header.
1345 AddStoreMapConstant(function_context,
1346 isolate()->factory()->function_context_map());
1347 Add<HStoreNamedField>(function_context,
1348 HObjectAccess::ForFixedArrayLength(),
1349 Add<HConstant>(length));
1350
1351 // Set up the fixed slots.
1352 Add<HStoreNamedField>(function_context,
1353 HObjectAccess::ForContextSlot(Context::CLOSURE_INDEX),
1354 function);
1355 Add<HStoreNamedField>(function_context,
1356 HObjectAccess::ForContextSlot(Context::PREVIOUS_INDEX),
1357 context());
1358 Add<HStoreNamedField>(function_context,
1359 HObjectAccess::ForContextSlot(Context::EXTENSION_INDEX),
1360 graph()->GetConstant0());
1361
1362 // Copy the global object from the previous context.
1363 HValue* global_object = Add<HLoadNamedField>(
1364 context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
1365 Add<HStoreNamedField>(function_context,
1366 HObjectAccess::ForContextSlot(
1367 Context::GLOBAL_OBJECT_INDEX),
1368 global_object);
1369
1370 // Initialize the rest of the slots to undefined.
1371 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) {
1372 Add<HStoreNamedField>(function_context,
1373 HObjectAccess::ForContextSlot(i),
1374 graph()->GetConstantUndefined());
1375 }
1376
1377 return function_context;
1378 }
1379
1380
1381 Handle<Code> FastNewContextStub::GenerateCode(Isolate* isolate) {
1382 return DoGenerateCode(isolate, this);
1383 }
1384
1385
1386 template<>
1336 HValue* CodeStubGraphBuilder<KeyedLoadDictionaryElementStub>::BuildCodeStub() { 1387 HValue* CodeStubGraphBuilder<KeyedLoadDictionaryElementStub>::BuildCodeStub() {
1337 HValue* receiver = GetParameter(0); 1388 HValue* receiver = GetParameter(0);
1338 HValue* key = GetParameter(1); 1389 HValue* key = GetParameter(1);
1339 1390
1340 Add<HCheckSmi>(key); 1391 Add<HCheckSmi>(key);
1341 1392
1342 return BuildUncheckedDictionaryElementLoad(receiver, key); 1393 return BuildUncheckedDictionaryElementLoad(receiver, key);
1343 } 1394 }
1344 1395
1345 1396
1346 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { 1397 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) {
1347 return DoGenerateCode(isolate, this); 1398 return DoGenerateCode(isolate, this);
1348 } 1399 }
1349 1400
1350 1401
1351 } } // namespace v8::internal 1402 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698