| OLD | NEW |
| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { | 336 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { |
| 337 return DoGenerateCode(isolate, this); | 337 return DoGenerateCode(isolate, this); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 template <> | 341 template <> |
| 342 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { | 342 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { |
| 343 info()->MarkAsSavesCallerDoubles(); | 343 info()->MarkAsSavesCallerDoubles(); |
| 344 HValue* number = GetParameter(NumberToStringStub::kNumber); | 344 HValue* number = GetParameter(NumberToStringStub::kNumber); |
| 345 return BuildNumberToString(number, Type::Number(isolate())); | 345 return BuildNumberToString(number, Type::Number(zone())); |
| 346 } | 346 } |
| 347 | 347 |
| 348 | 348 |
| 349 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { | 349 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { |
| 350 return DoGenerateCode(isolate, this); | 350 return DoGenerateCode(isolate, this); |
| 351 } | 351 } |
| 352 | 352 |
| 353 | 353 |
| 354 template <> | 354 template <> |
| 355 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { | 355 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 return DoGenerateCode(isolate, this); | 869 return DoGenerateCode(isolate, this); |
| 870 } | 870 } |
| 871 | 871 |
| 872 | 872 |
| 873 template <> | 873 template <> |
| 874 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { | 874 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { |
| 875 Isolate* isolate = graph()->isolate(); | 875 Isolate* isolate = graph()->isolate(); |
| 876 CompareNilICStub* stub = casted_stub(); | 876 CompareNilICStub* stub = casted_stub(); |
| 877 HIfContinuation continuation; | 877 HIfContinuation continuation; |
| 878 Handle<Map> sentinel_map(isolate->heap()->meta_map()); | 878 Handle<Map> sentinel_map(isolate->heap()->meta_map()); |
| 879 Handle<Type> type = stub->GetType(isolate, sentinel_map); | 879 Type* type = stub->GetType(zone(), sentinel_map); |
| 880 BuildCompareNil(GetParameter(0), type, &continuation); | 880 BuildCompareNil(GetParameter(0), type, &continuation); |
| 881 IfBuilder if_nil(this, &continuation); | 881 IfBuilder if_nil(this, &continuation); |
| 882 if_nil.Then(); | 882 if_nil.Then(); |
| 883 if (continuation.IsFalseReachable()) { | 883 if (continuation.IsFalseReachable()) { |
| 884 if_nil.Else(); | 884 if_nil.Else(); |
| 885 if_nil.Return(graph()->GetConstant0()); | 885 if_nil.Return(graph()->GetConstant0()); |
| 886 } | 886 } |
| 887 if_nil.End(); | 887 if_nil.End(); |
| 888 return continuation.IsTrueReachable() | 888 return continuation.IsTrueReachable() |
| 889 ? graph()->GetConstant1() | 889 ? graph()->GetConstant1() |
| 890 : graph()->GetConstantUndefined(); | 890 : graph()->GetConstantUndefined(); |
| 891 } | 891 } |
| 892 | 892 |
| 893 | 893 |
| 894 Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) { | 894 Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) { |
| 895 return DoGenerateCode(isolate, this); | 895 return DoGenerateCode(isolate, this); |
| 896 } | 896 } |
| 897 | 897 |
| 898 | 898 |
| 899 template <> | 899 template <> |
| 900 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { | 900 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { |
| 901 BinaryOpIC::State state = casted_stub()->state(); | 901 BinaryOpIC::State state = casted_stub()->state(); |
| 902 | 902 |
| 903 HValue* left = GetParameter(BinaryOpICStub::kLeft); | 903 HValue* left = GetParameter(BinaryOpICStub::kLeft); |
| 904 HValue* right = GetParameter(BinaryOpICStub::kRight); | 904 HValue* right = GetParameter(BinaryOpICStub::kRight); |
| 905 | 905 |
| 906 Handle<Type> left_type = state.GetLeftType(isolate()); | 906 Type* left_type = state.GetLeftType(zone()); |
| 907 Handle<Type> right_type = state.GetRightType(isolate()); | 907 Type* right_type = state.GetRightType(zone()); |
| 908 Handle<Type> result_type = state.GetResultType(isolate()); | 908 Type* result_type = state.GetResultType(zone()); |
| 909 | 909 |
| 910 ASSERT(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) && | 910 ASSERT(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) && |
| 911 (state.HasSideEffects() || !result_type->Is(Type::None()))); | 911 (state.HasSideEffects() || !result_type->Is(Type::None()))); |
| 912 | 912 |
| 913 HValue* result = NULL; | 913 HValue* result = NULL; |
| 914 if (state.op() == Token::ADD && | 914 if (state.op() == Token::ADD && |
| 915 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && | 915 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && |
| 916 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { | 916 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { |
| 917 // For the generic add stub a fast case for string addition is performance | 917 // For the generic add stub a fast case for string addition is performance |
| 918 // critical. | 918 // critical. |
| 919 if (left_type->Maybe(Type::String())) { | 919 if (left_type->Maybe(Type::String())) { |
| 920 IfBuilder if_leftisstring(this); | 920 IfBuilder if_leftisstring(this); |
| 921 if_leftisstring.If<HIsStringAndBranch>(left); | 921 if_leftisstring.If<HIsStringAndBranch>(left); |
| 922 if_leftisstring.Then(); | 922 if_leftisstring.Then(); |
| 923 { | 923 { |
| 924 Push(BuildBinaryOperation( | 924 Push(BuildBinaryOperation( |
| 925 state.op(), left, right, | 925 state.op(), left, right, |
| 926 Type::String(isolate()), right_type, | 926 Type::String(zone()), right_type, |
| 927 result_type, state.fixed_right_arg())); | 927 result_type, state.fixed_right_arg())); |
| 928 } | 928 } |
| 929 if_leftisstring.Else(); | 929 if_leftisstring.Else(); |
| 930 { | 930 { |
| 931 Push(BuildBinaryOperation( | 931 Push(BuildBinaryOperation( |
| 932 state.op(), left, right, | 932 state.op(), left, right, |
| 933 left_type, right_type, result_type, | 933 left_type, right_type, result_type, |
| 934 state.fixed_right_arg())); | 934 state.fixed_right_arg())); |
| 935 } | 935 } |
| 936 if_leftisstring.End(); | 936 if_leftisstring.End(); |
| 937 result = Pop(); | 937 result = Pop(); |
| 938 } else { | 938 } else { |
| 939 IfBuilder if_rightisstring(this); | 939 IfBuilder if_rightisstring(this); |
| 940 if_rightisstring.If<HIsStringAndBranch>(right); | 940 if_rightisstring.If<HIsStringAndBranch>(right); |
| 941 if_rightisstring.Then(); | 941 if_rightisstring.Then(); |
| 942 { | 942 { |
| 943 Push(BuildBinaryOperation( | 943 Push(BuildBinaryOperation( |
| 944 state.op(), left, right, | 944 state.op(), left, right, |
| 945 left_type, Type::String(isolate()), | 945 left_type, Type::String(zone()), |
| 946 result_type, state.fixed_right_arg())); | 946 result_type, state.fixed_right_arg())); |
| 947 } | 947 } |
| 948 if_rightisstring.Else(); | 948 if_rightisstring.Else(); |
| 949 { | 949 { |
| 950 Push(BuildBinaryOperation( | 950 Push(BuildBinaryOperation( |
| 951 state.op(), left, right, | 951 state.op(), left, right, |
| 952 left_type, right_type, result_type, | 952 left_type, right_type, result_type, |
| 953 state.fixed_right_arg())); | 953 state.fixed_right_arg())); |
| 954 } | 954 } |
| 955 if_rightisstring.End(); | 955 if_rightisstring.End(); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 return BuildUncheckedDictionaryElementLoad(receiver, key); | 1332 return BuildUncheckedDictionaryElementLoad(receiver, key); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 | 1335 |
| 1336 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { | 1336 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { |
| 1337 return DoGenerateCode(isolate, this); | 1337 return DoGenerateCode(isolate, this); |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 | 1340 |
| 1341 } } // namespace v8::internal | 1341 } } // namespace v8::internal |
| OLD | NEW |