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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 5033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5044 DCHECK(current_block() != NULL); | 5044 DCHECK(current_block() != NULL); |
5045 DCHECK(current_block()->HasPredecessor()); | 5045 DCHECK(current_block()->HasPredecessor()); |
5046 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( | 5046 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
5047 expr, current_info()->script(), top_info()); | 5047 expr, current_info()->script(), top_info()); |
5048 // We also have a stack overflow if the recursive compilation did. | 5048 // We also have a stack overflow if the recursive compilation did. |
5049 if (HasStackOverflow()) return; | 5049 if (HasStackOverflow()) return; |
5050 // Use the fast case closure allocation code that allocates in new | 5050 // Use the fast case closure allocation code that allocates in new |
5051 // space for nested functions that don't need pretenuring. | 5051 // space for nested functions that don't need pretenuring. |
5052 HConstant* shared_info_value = Add<HConstant>(shared_info); | 5052 HConstant* shared_info_value = Add<HConstant>(shared_info); |
5053 HInstruction* instr; | 5053 HInstruction* instr; |
| 5054 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); |
| 5055 HValue* vector_value = Add<HConstant>(vector); |
| 5056 int index = TypeFeedbackVector::GetIndex(expr->LiteralFeedbackSlot()); |
| 5057 HValue* index_value = Add<HConstant>(index); |
5054 if (!expr->pretenure()) { | 5058 if (!expr->pretenure()) { |
5055 FastNewClosureStub stub(isolate()); | 5059 FastNewClosureStub stub(isolate()); |
5056 FastNewClosureDescriptor descriptor(isolate()); | 5060 FastNewClosureDescriptor descriptor(isolate()); |
5057 HValue* values[] = {shared_info_value}; | |
5058 HConstant* stub_value = Add<HConstant>(stub.GetCode()); | 5061 HConstant* stub_value = Add<HConstant>(stub.GetCode()); |
| 5062 // Retrieve the literals array from the vector. |
| 5063 HValue* values[] = {shared_info_value, vector_value, index_value}; |
5059 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, | 5064 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
5060 ArrayVector(values)); | 5065 ArrayVector(values)); |
5061 } else { | 5066 } else { |
5062 Add<HPushArguments>(shared_info_value); | 5067 Add<HPushArguments>(shared_info_value); |
| 5068 Add<HPushArguments>(vector_value); |
| 5069 Add<HPushArguments>(index_value); |
5063 Runtime::FunctionId function_id = | 5070 Runtime::FunctionId function_id = |
5064 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; | 5071 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; |
5065 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 1); | 5072 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 3); |
5066 } | 5073 } |
5067 return ast_context()->ReturnInstruction(instr, expr->id()); | 5074 return ast_context()->ReturnInstruction(instr, expr->id()); |
5068 } | 5075 } |
5069 | 5076 |
5070 | 5077 |
5071 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { | 5078 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { |
5072 DCHECK(!HasStackOverflow()); | 5079 DCHECK(!HasStackOverflow()); |
5073 DCHECK(current_block() != NULL); | 5080 DCHECK(current_block() != NULL); |
5074 DCHECK(current_block()->HasPredecessor()); | 5081 DCHECK(current_block()->HasPredecessor()); |
5075 return Bailout(kClassLiteral); | 5082 return Bailout(kClassLiteral); |
(...skipping 7935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13011 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13018 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13012 } | 13019 } |
13013 | 13020 |
13014 #ifdef DEBUG | 13021 #ifdef DEBUG |
13015 graph_->Verify(false); // No full verify. | 13022 graph_->Verify(false); // No full verify. |
13016 #endif | 13023 #endif |
13017 } | 13024 } |
13018 | 13025 |
13019 } // namespace internal | 13026 } // namespace internal |
13020 } // namespace v8 | 13027 } // namespace v8 |
OLD | NEW |