OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2896 Branch(WordEqual(value, NullConstant()), &if_valueisnullorundefined, | 2896 Branch(WordEqual(value, NullConstant()), &if_valueisnullorundefined, |
2897 &if_valueisnotnull); | 2897 &if_valueisnotnull); |
2898 BIND(&if_valueisnotnull); | 2898 BIND(&if_valueisnotnull); |
2899 { | 2899 { |
2900 // Check if the {value} is undefined. | 2900 // Check if the {value} is undefined. |
2901 Branch(WordEqual(value, UndefinedConstant()), | 2901 Branch(WordEqual(value, UndefinedConstant()), |
2902 &if_valueisnullorundefined, &if_valueisnotnullorundefined); | 2902 &if_valueisnullorundefined, &if_valueisnotnullorundefined); |
2903 BIND(&if_valueisnotnullorundefined); | 2903 BIND(&if_valueisnotnullorundefined); |
2904 { | 2904 { |
2905 // Convert the {value} to a String. | 2905 // Convert the {value} to a String. |
2906 Callable callable = CodeFactory::ToString(isolate()); | 2906 var_value.Bind(CallBuiltin(Builtins::kToString, context, value)); |
2907 var_value.Bind(CallStub(callable, context, value)); | |
2908 Goto(&if_valueisstring); | 2907 Goto(&if_valueisstring); |
2909 } | 2908 } |
2910 } | 2909 } |
2911 | 2910 |
2912 BIND(&if_valueisnullorundefined); | 2911 BIND(&if_valueisnullorundefined); |
2913 { | 2912 { |
2914 // The {value} is either null or undefined. | 2913 // The {value} is either null or undefined. |
2915 CallRuntime(Runtime::kThrowCalledOnNullOrUndefined, context, | 2914 CallRuntime(Runtime::kThrowCalledOnNullOrUndefined, context, |
2916 HeapConstant(factory()->NewStringFromAsciiChecked( | 2915 HeapConstant(factory()->NewStringFromAsciiChecked( |
2917 method_name, TENURED))); | 2916 method_name, TENURED))); |
(...skipping 4322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7240 | 7239 |
7241 BIND(&if_rhsisstring); | 7240 BIND(&if_rhsisstring); |
7242 { | 7241 { |
7243 // Both {lhs} and {rhs} are strings. | 7242 // Both {lhs} and {rhs} are strings. |
7244 if (var_type_feedback != nullptr) { | 7243 if (var_type_feedback != nullptr) { |
7245 CombineFeedback(var_type_feedback, | 7244 CombineFeedback(var_type_feedback, |
7246 SmiConstant(CompareOperationFeedback::kString)); | 7245 SmiConstant(CompareOperationFeedback::kString)); |
7247 } | 7246 } |
7248 switch (mode) { | 7247 switch (mode) { |
7249 case kLessThan: | 7248 case kLessThan: |
7250 result.Bind(CallStub(CodeFactory::StringLessThan(isolate()), | 7249 result.Bind(CallBuiltin(Builtins::kStringLessThan, context, |
7251 context, lhs, rhs)); | 7250 lhs, rhs)); |
7252 Goto(&end); | 7251 Goto(&end); |
7253 break; | 7252 break; |
7254 case kLessThanOrEqual: | 7253 case kLessThanOrEqual: |
7255 result.Bind( | 7254 result.Bind(CallBuiltin(Builtins::kStringLessThanOrEqual, |
7256 CallStub(CodeFactory::StringLessThanOrEqual(isolate()), | 7255 context, lhs, rhs)); |
7257 context, lhs, rhs)); | |
7258 Goto(&end); | 7256 Goto(&end); |
7259 break; | 7257 break; |
7260 case kGreaterThan: | 7258 case kGreaterThan: |
7261 result.Bind( | 7259 result.Bind(CallBuiltin(Builtins::kStringGreaterThan, context, |
7262 CallStub(CodeFactory::StringGreaterThan(isolate()), | 7260 lhs, rhs)); |
7263 context, lhs, rhs)); | |
7264 Goto(&end); | 7261 Goto(&end); |
7265 break; | 7262 break; |
7266 case kGreaterThanOrEqual: | 7263 case kGreaterThanOrEqual: |
7267 result.Bind( | 7264 result.Bind(CallBuiltin(Builtins::kStringGreaterThanOrEqual, |
7268 CallStub(CodeFactory::StringGreaterThanOrEqual(isolate()), | 7265 context, lhs, rhs)); |
7269 context, lhs, rhs)); | |
7270 Goto(&end); | 7266 Goto(&end); |
7271 break; | 7267 break; |
7272 } | 7268 } |
7273 } | 7269 } |
7274 | 7270 |
7275 BIND(&if_rhsisnotstring); | 7271 BIND(&if_rhsisnotstring); |
7276 { | 7272 { |
7277 // The {lhs} is a String and {rhs} is not a String. | 7273 // The {lhs} is a String and {rhs} is not a String. |
7278 if (var_type_feedback != nullptr) { | 7274 if (var_type_feedback != nullptr) { |
7279 var_type_feedback->Bind( | 7275 var_type_feedback->Bind( |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7728 // Check if {rhs} is also a String. | 7724 // Check if {rhs} is also a String. |
7729 Label if_rhsisstring(this, Label::kDeferred), | 7725 Label if_rhsisstring(this, Label::kDeferred), |
7730 if_rhsisnotstring(this); | 7726 if_rhsisnotstring(this); |
7731 Branch(IsStringInstanceType(rhs_instance_type), &if_rhsisstring, | 7727 Branch(IsStringInstanceType(rhs_instance_type), &if_rhsisstring, |
7732 &if_rhsisnotstring); | 7728 &if_rhsisnotstring); |
7733 | 7729 |
7734 BIND(&if_rhsisstring); | 7730 BIND(&if_rhsisstring); |
7735 { | 7731 { |
7736 // Both {lhs} and {rhs} are of type String, just do the | 7732 // Both {lhs} and {rhs} are of type String, just do the |
7737 // string comparison then. | 7733 // string comparison then. |
7738 Callable callable = CodeFactory::StringEqual(isolate()); | 7734 result.Bind( |
7739 result.Bind(CallStub(callable, context, lhs, rhs)); | 7735 CallBuiltin(Builtins::kStringEqual, context, lhs, rhs)); |
7740 if (var_type_feedback != nullptr) { | 7736 if (var_type_feedback != nullptr) { |
7741 Node* lhs_feedback = | 7737 Node* lhs_feedback = |
7742 CollectFeedbackForString(lhs_instance_type); | 7738 CollectFeedbackForString(lhs_instance_type); |
7743 Node* rhs_feedback = | 7739 Node* rhs_feedback = |
7744 CollectFeedbackForString(rhs_instance_type); | 7740 CollectFeedbackForString(rhs_instance_type); |
7745 CombineFeedback(var_type_feedback, | 7741 CombineFeedback(var_type_feedback, |
7746 SmiOr(lhs_feedback, rhs_feedback)); | 7742 SmiOr(lhs_feedback, rhs_feedback)); |
7747 } | 7743 } |
7748 Goto(&end); | 7744 Goto(&end); |
7749 } | 7745 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8207 BIND(&if_lhsisstring); | 8203 BIND(&if_lhsisstring); |
8208 { | 8204 { |
8209 // Check if {rhs} is also a String. | 8205 // Check if {rhs} is also a String. |
8210 Label if_rhsisstring(this, Label::kDeferred), | 8206 Label if_rhsisstring(this, Label::kDeferred), |
8211 if_rhsisnotstring(this); | 8207 if_rhsisnotstring(this); |
8212 Branch(IsStringInstanceType(rhs_instance_type), &if_rhsisstring, | 8208 Branch(IsStringInstanceType(rhs_instance_type), &if_rhsisstring, |
8213 &if_rhsisnotstring); | 8209 &if_rhsisnotstring); |
8214 | 8210 |
8215 BIND(&if_rhsisstring); | 8211 BIND(&if_rhsisstring); |
8216 { | 8212 { |
8217 Callable callable = CodeFactory::StringEqual(isolate()); | |
8218 if (var_type_feedback != nullptr) { | 8213 if (var_type_feedback != nullptr) { |
8219 Node* lhs_feedback = | 8214 Node* lhs_feedback = |
8220 CollectFeedbackForString(lhs_instance_type); | 8215 CollectFeedbackForString(lhs_instance_type); |
8221 Node* rhs_feedback = | 8216 Node* rhs_feedback = |
8222 CollectFeedbackForString(rhs_instance_type); | 8217 CollectFeedbackForString(rhs_instance_type); |
8223 var_type_feedback->Bind(SmiOr(lhs_feedback, rhs_feedback)); | 8218 var_type_feedback->Bind(SmiOr(lhs_feedback, rhs_feedback)); |
8224 } | 8219 } |
8225 result.Bind(CallStub(callable, NoContextConstant(), lhs, rhs)); | 8220 result.Bind(CallBuiltin(Builtins::kStringEqual, |
| 8221 NoContextConstant(), lhs, rhs)); |
8226 Goto(&end); | 8222 Goto(&end); |
8227 } | 8223 } |
8228 | 8224 |
8229 BIND(&if_rhsisnotstring); | 8225 BIND(&if_rhsisnotstring); |
8230 Goto(&if_notequal); | 8226 Goto(&if_notequal); |
8231 } | 8227 } |
8232 | 8228 |
8233 BIND(&if_lhsisnotstring); | 8229 BIND(&if_lhsisnotstring); |
8234 if (var_type_feedback != nullptr) { | 8230 if (var_type_feedback != nullptr) { |
8235 Label if_lhsissymbol(this), if_lhsisreceiver(this); | 8231 Label if_lhsissymbol(this), if_lhsisreceiver(this); |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9273 formatted.c_str(), TENURED); | 9269 formatted.c_str(), TENURED); |
9274 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 9270 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
9275 HeapConstant(string)); | 9271 HeapConstant(string)); |
9276 } | 9272 } |
9277 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 9273 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
9278 #endif | 9274 #endif |
9279 } | 9275 } |
9280 | 9276 |
9281 } // namespace internal | 9277 } // namespace internal |
9282 } // namespace v8 | 9278 } // namespace v8 |
OLD | NEW |