| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 6822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6833 return Add<HConstant>(c_string->StringValue()->map()->instance_type()); | 6833 return Add<HConstant>(c_string->StringValue()->map()->instance_type()); |
| 6834 } | 6834 } |
| 6835 } | 6835 } |
| 6836 return Add<HLoadNamedField>( | 6836 return Add<HLoadNamedField>( |
| 6837 Add<HLoadNamedField>(string, nullptr, HObjectAccess::ForMap()), nullptr, | 6837 Add<HLoadNamedField>(string, nullptr, HObjectAccess::ForMap()), nullptr, |
| 6838 HObjectAccess::ForMapInstanceType()); | 6838 HObjectAccess::ForMapInstanceType()); |
| 6839 } | 6839 } |
| 6840 | 6840 |
| 6841 | 6841 |
| 6842 HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) { | 6842 HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) { |
| 6843 return AddInstruction(BuildLoadStringLength(string)); |
| 6844 } |
| 6845 |
| 6846 |
| 6847 HInstruction* HGraphBuilder::BuildLoadStringLength(HValue* string) { |
| 6843 if (string->IsConstant()) { | 6848 if (string->IsConstant()) { |
| 6844 HConstant* c_string = HConstant::cast(string); | 6849 HConstant* c_string = HConstant::cast(string); |
| 6845 if (c_string->HasStringValue()) { | 6850 if (c_string->HasStringValue()) { |
| 6846 return Add<HConstant>(c_string->StringValue()->length()); | 6851 return New<HConstant>(c_string->StringValue()->length()); |
| 6847 } | 6852 } |
| 6848 } | 6853 } |
| 6849 return Add<HLoadNamedField>(string, nullptr, | 6854 return New<HLoadNamedField>(string, nullptr, |
| 6850 HObjectAccess::ForStringLength()); | 6855 HObjectAccess::ForStringLength()); |
| 6851 } | 6856 } |
| 6852 | 6857 |
| 6853 | 6858 |
| 6854 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( | 6859 HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( |
| 6855 PropertyAccessType access_type, Expression* expr, HValue* object, | 6860 PropertyAccessType access_type, Expression* expr, HValue* object, |
| 6856 Handle<String> name, HValue* value, bool is_uninitialized) { | 6861 Handle<String> name, HValue* value, bool is_uninitialized) { |
| 6857 if (is_uninitialized) { | 6862 if (is_uninitialized) { |
| 6858 Add<HDeoptimize>( | 6863 Add<HDeoptimize>( |
| 6859 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, | 6864 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, |
| (...skipping 5012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11872 PushArgumentsFromEnvironment(call->arguments()->length()); | 11877 PushArgumentsFromEnvironment(call->arguments()->length()); |
| 11873 HCallStub* result = New<HCallStub>(CodeStub::StringCompare, 2); | 11878 HCallStub* result = New<HCallStub>(CodeStub::StringCompare, 2); |
| 11874 return ast_context()->ReturnInstruction(result, call->id()); | 11879 return ast_context()->ReturnInstruction(result, call->id()); |
| 11875 } | 11880 } |
| 11876 | 11881 |
| 11877 | 11882 |
| 11878 void HOptimizedGraphBuilder::GenerateStringGetLength(CallRuntime* call) { | 11883 void HOptimizedGraphBuilder::GenerateStringGetLength(CallRuntime* call) { |
| 11879 DCHECK(call->arguments()->length() == 1); | 11884 DCHECK(call->arguments()->length() == 1); |
| 11880 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 11885 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 11881 HValue* string = Pop(); | 11886 HValue* string = Pop(); |
| 11882 HInstruction* result = AddLoadStringLength(string); | 11887 HInstruction* result = BuildLoadStringLength(string); |
| 11883 return ast_context()->ReturnInstruction(result, call->id()); | 11888 return ast_context()->ReturnInstruction(result, call->id()); |
| 11884 } | 11889 } |
| 11885 | 11890 |
| 11886 | 11891 |
| 11887 // Support for direct calls from JavaScript to native RegExp code. | 11892 // Support for direct calls from JavaScript to native RegExp code. |
| 11888 void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) { | 11893 void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) { |
| 11889 DCHECK_EQ(4, call->arguments()->length()); | 11894 DCHECK_EQ(4, call->arguments()->length()); |
| 11890 CHECK_ALIVE(VisitExpressions(call->arguments())); | 11895 CHECK_ALIVE(VisitExpressions(call->arguments())); |
| 11891 PushArgumentsFromEnvironment(call->arguments()->length()); | 11896 PushArgumentsFromEnvironment(call->arguments()->length()); |
| 11892 HCallStub* result = New<HCallStub>(CodeStub::RegExpExec, 4); | 11897 HCallStub* result = New<HCallStub>(CodeStub::RegExpExec, 4); |
| (...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13403 if (ShouldProduceTraceOutput()) { | 13408 if (ShouldProduceTraceOutput()) { |
| 13404 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13409 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13405 } | 13410 } |
| 13406 | 13411 |
| 13407 #ifdef DEBUG | 13412 #ifdef DEBUG |
| 13408 graph_->Verify(false); // No full verify. | 13413 graph_->Verify(false); // No full verify. |
| 13409 #endif | 13414 #endif |
| 13410 } | 13415 } |
| 13411 | 13416 |
| 13412 } } // namespace v8::internal | 13417 } } // namespace v8::internal |
| OLD | NEW |