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 5388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5399 } | 5399 } |
5400 } else { | 5400 } else { |
5401 HValue* global_object = Add<HLoadNamedField>( | 5401 HValue* global_object = Add<HLoadNamedField>( |
5402 context(), nullptr, | 5402 context(), nullptr, |
5403 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5403 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
5404 HLoadGlobalGeneric* instr = | 5404 HLoadGlobalGeneric* instr = |
5405 New<HLoadGlobalGeneric>(global_object, | 5405 New<HLoadGlobalGeneric>(global_object, |
5406 variable->name(), | 5406 variable->name(), |
5407 ast_context()->is_for_typeof()); | 5407 ast_context()->is_for_typeof()); |
5408 if (FLAG_vector_ics) { | 5408 if (FLAG_vector_ics) { |
5409 Handle<SharedFunctionInfo> current_shared = | 5409 instr->SetVectorAndSlot(handle(current_feedback_vector(), isolate()), |
5410 function_state()->compilation_info()->shared_info(); | 5410 expr->VariableFeedbackSlot()); |
5411 instr->SetVectorAndSlot( | |
5412 handle(current_shared->feedback_vector(), isolate()), | |
5413 expr->VariableFeedbackSlot()); | |
5414 } | 5411 } |
5415 return ast_context()->ReturnInstruction(instr, expr->id()); | 5412 return ast_context()->ReturnInstruction(instr, expr->id()); |
5416 } | 5413 } |
5417 } | 5414 } |
5418 | 5415 |
5419 case Variable::PARAMETER: | 5416 case Variable::PARAMETER: |
5420 case Variable::LOCAL: { | 5417 case Variable::LOCAL: { |
5421 HValue* value = LookupAndMakeLive(variable); | 5418 HValue* value = LookupAndMakeLive(variable); |
5422 if (value == graph()->GetConstantHole()) { | 5419 if (value == graph()->GetConstantHole()) { |
5423 DCHECK(IsDeclaredVariableMode(variable->mode()) && | 5420 DCHECK(IsDeclaredVariableMode(variable->mode()) && |
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6894 Handle<String> name, HValue* value, bool is_uninitialized) { | 6891 Handle<String> name, HValue* value, bool is_uninitialized) { |
6895 if (is_uninitialized) { | 6892 if (is_uninitialized) { |
6896 Add<HDeoptimize>( | 6893 Add<HDeoptimize>( |
6897 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, | 6894 Deoptimizer::kInsufficientTypeFeedbackForGenericNamedAccess, |
6898 Deoptimizer::SOFT); | 6895 Deoptimizer::SOFT); |
6899 } | 6896 } |
6900 if (access_type == LOAD) { | 6897 if (access_type == LOAD) { |
6901 HLoadNamedGeneric* result = | 6898 HLoadNamedGeneric* result = |
6902 New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); | 6899 New<HLoadNamedGeneric>(object, name, PREMONOMORPHIC); |
6903 if (FLAG_vector_ics) { | 6900 if (FLAG_vector_ics) { |
6904 Handle<SharedFunctionInfo> current_shared = | |
6905 function_state()->compilation_info()->shared_info(); | |
6906 Handle<TypeFeedbackVector> vector = | 6901 Handle<TypeFeedbackVector> vector = |
6907 handle(current_shared->feedback_vector(), isolate()); | 6902 handle(current_feedback_vector(), isolate()); |
6908 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); | 6903 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); |
6909 result->SetVectorAndSlot(vector, slot); | 6904 result->SetVectorAndSlot(vector, slot); |
6910 } | 6905 } |
6911 return result; | 6906 return result; |
6912 } else { | 6907 } else { |
6913 return New<HStoreNamedGeneric>(object, name, value, | 6908 return New<HStoreNamedGeneric>(object, name, value, |
6914 function_language_mode(), PREMONOMORPHIC); | 6909 function_language_mode(), PREMONOMORPHIC); |
6915 } | 6910 } |
6916 } | 6911 } |
6917 | 6912 |
6918 | 6913 |
6919 | 6914 |
6920 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( | 6915 HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric( |
6921 PropertyAccessType access_type, | 6916 PropertyAccessType access_type, |
6922 Expression* expr, | 6917 Expression* expr, |
6923 HValue* object, | 6918 HValue* object, |
6924 HValue* key, | 6919 HValue* key, |
6925 HValue* value) { | 6920 HValue* value) { |
6926 if (access_type == LOAD) { | 6921 if (access_type == LOAD) { |
6927 HLoadKeyedGeneric* result = | 6922 // HLoadKeyedGeneric with vector ics benefits from being encoded as |
6928 New<HLoadKeyedGeneric>(object, key, PREMONOMORPHIC); | 6923 // MEGAMORPHIC because the vector/slot combo becomes unnecessary. |
6929 if (FLAG_vector_ics) { | 6924 HLoadKeyedGeneric* result = New<HLoadKeyedGeneric>( |
6930 Handle<SharedFunctionInfo> current_shared = | 6925 object, key, FLAG_vector_ics ? MEGAMORPHIC : PREMONOMORPHIC); |
6931 function_state()->compilation_info()->shared_info(); | |
6932 Handle<TypeFeedbackVector> vector = | |
6933 handle(current_shared->feedback_vector(), isolate()); | |
6934 FeedbackVectorICSlot slot = expr->AsProperty()->PropertyFeedbackSlot(); | |
6935 result->SetVectorAndSlot(vector, slot); | |
6936 } | |
6937 return result; | 6926 return result; |
6938 } else { | 6927 } else { |
6939 return New<HStoreKeyedGeneric>(object, key, value, function_language_mode(), | 6928 return New<HStoreKeyedGeneric>(object, key, value, function_language_mode(), |
6940 PREMONOMORPHIC); | 6929 PREMONOMORPHIC); |
6941 } | 6930 } |
6942 } | 6931 } |
6943 | 6932 |
6944 | 6933 |
6945 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { | 6934 LoadKeyedHoleMode HOptimizedGraphBuilder::BuildKeyedHoleMode(Handle<Map> map) { |
6946 // Loads from a "stock" fast holey double arrays can elide the hole check. | 6935 // Loads from a "stock" fast holey double arrays can elide the hole check. |
(...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9318 call = BuildCallConstantFunction(expr->target(), argument_count); | 9307 call = BuildCallConstantFunction(expr->target(), argument_count); |
9319 } else { | 9308 } else { |
9320 PushArgumentsFromEnvironment(argument_count); | 9309 PushArgumentsFromEnvironment(argument_count); |
9321 HCallFunction* call_function = | 9310 HCallFunction* call_function = |
9322 New<HCallFunction>(function, argument_count); | 9311 New<HCallFunction>(function, argument_count); |
9323 call = call_function; | 9312 call = call_function; |
9324 if (expr->is_uninitialized() && | 9313 if (expr->is_uninitialized() && |
9325 expr->IsUsingCallFeedbackICSlot(isolate())) { | 9314 expr->IsUsingCallFeedbackICSlot(isolate())) { |
9326 // We've never seen this call before, so let's have Crankshaft learn | 9315 // We've never seen this call before, so let's have Crankshaft learn |
9327 // through the type vector. | 9316 // through the type vector. |
9328 Handle<SharedFunctionInfo> current_shared = | |
9329 function_state()->compilation_info()->shared_info(); | |
9330 Handle<TypeFeedbackVector> vector = | 9317 Handle<TypeFeedbackVector> vector = |
9331 handle(current_shared->feedback_vector(), isolate()); | 9318 handle(current_feedback_vector(), isolate()); |
9332 FeedbackVectorICSlot slot = expr->CallFeedbackICSlot(); | 9319 FeedbackVectorICSlot slot = expr->CallFeedbackICSlot(); |
9333 call_function->SetVectorAndSlot(vector, slot); | 9320 call_function->SetVectorAndSlot(vector, slot); |
9334 } | 9321 } |
9335 } | 9322 } |
9336 } | 9323 } |
9337 | 9324 |
9338 Drop(1); // Drop the function. | 9325 Drop(1); // Drop the function. |
9339 return ast_context()->ReturnInstruction(call, expr->id()); | 9326 return ast_context()->ReturnInstruction(call, expr->id()); |
9340 } | 9327 } |
9341 | 9328 |
(...skipping 3618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12960 if (ShouldProduceTraceOutput()) { | 12947 if (ShouldProduceTraceOutput()) { |
12961 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12948 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12962 } | 12949 } |
12963 | 12950 |
12964 #ifdef DEBUG | 12951 #ifdef DEBUG |
12965 graph_->Verify(false); // No full verify. | 12952 graph_->Verify(false); // No full verify. |
12966 #endif | 12953 #endif |
12967 } | 12954 } |
12968 | 12955 |
12969 } } // namespace v8::internal | 12956 } } // namespace v8::internal |
OLD | NEW |