OLD | NEW |
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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/code-factory.h" |
10 #include "src/crankshaft/hydrogen.h" | 11 #include "src/crankshaft/hydrogen.h" |
11 #include "src/crankshaft/lithium.h" | 12 #include "src/crankshaft/lithium.h" |
12 #include "src/field-index.h" | 13 #include "src/field-index.h" |
13 #include "src/ic/ic.h" | 14 #include "src/ic/ic.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 | 19 |
19 static LChunk* OptimizeGraph(HGraph* graph) { | 20 static LChunk* OptimizeGraph(HGraph* graph) { |
(...skipping 1015 matching lines...) Loading... |
1035 // The input is already a primitive. | 1036 // The input is already a primitive. |
1036 Push(input); | 1037 Push(input); |
1037 } | 1038 } |
1038 if_inputisprimitive.Else(); | 1039 if_inputisprimitive.Else(); |
1039 { | 1040 { |
1040 // Convert the input to a primitive. | 1041 // Convert the input to a primitive. |
1041 Push(BuildToPrimitive(input, input_map)); | 1042 Push(BuildToPrimitive(input, input_map)); |
1042 } | 1043 } |
1043 if_inputisprimitive.End(); | 1044 if_inputisprimitive.End(); |
1044 // Convert the primitive to a string value. | 1045 // Convert the primitive to a string value. |
1045 ToStringStub stub(isolate()); | |
1046 HValue* values[] = {context(), Pop()}; | 1046 HValue* values[] = {context(), Pop()}; |
1047 Push(AddUncasted<HCallWithDescriptor>(Add<HConstant>(stub.GetCode()), 0, | 1047 Callable toString = CodeFactory::ToString(isolate()); |
1048 stub.GetCallInterfaceDescriptor(), | 1048 Push(AddUncasted<HCallWithDescriptor>(Add<HConstant>(toString.code()), 0, |
| 1049 toString.descriptor(), |
1049 ArrayVector(values))); | 1050 ArrayVector(values))); |
1050 } | 1051 } |
1051 if_inputisstring.End(); | 1052 if_inputisstring.End(); |
1052 } | 1053 } |
1053 if_inputissmi.End(); | 1054 if_inputissmi.End(); |
1054 return Pop(); | 1055 return Pop(); |
1055 } | 1056 } |
1056 | 1057 |
1057 | 1058 |
1058 HValue* CodeStubGraphBuilderBase::BuildToPrimitive(HValue* input, | 1059 HValue* CodeStubGraphBuilderBase::BuildToPrimitive(HValue* input, |
(...skipping 399 matching lines...) Loading... |
1458 return Pop(); | 1459 return Pop(); |
1459 } | 1460 } |
1460 | 1461 |
1461 | 1462 |
1462 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 1463 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
1463 return DoGenerateCode(this); | 1464 return DoGenerateCode(this); |
1464 } | 1465 } |
1465 | 1466 |
1466 } // namespace internal | 1467 } // namespace internal |
1467 } // namespace v8 | 1468 } // namespace v8 |
OLD | NEW |