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 5081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5092 DCHECK(current_block() != NULL); | 5092 DCHECK(current_block() != NULL); |
5093 DCHECK(current_block()->HasPredecessor()); | 5093 DCHECK(current_block()->HasPredecessor()); |
5094 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( | 5094 Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo( |
5095 expr, current_info()->script(), top_info()); | 5095 expr, current_info()->script(), top_info()); |
5096 // We also have a stack overflow if the recursive compilation did. | 5096 // We also have a stack overflow if the recursive compilation did. |
5097 if (HasStackOverflow()) return; | 5097 if (HasStackOverflow()) return; |
5098 // Use the fast case closure allocation code that allocates in new | 5098 // Use the fast case closure allocation code that allocates in new |
5099 // space for nested functions that don't need pretenuring. | 5099 // space for nested functions that don't need pretenuring. |
5100 HConstant* shared_info_value = Add<HConstant>(shared_info); | 5100 HConstant* shared_info_value = Add<HConstant>(shared_info); |
5101 HInstruction* instr; | 5101 HInstruction* instr; |
| 5102 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); |
| 5103 HValue* vector_value = Add<HConstant>(vector); |
| 5104 int index = TypeFeedbackVector::GetIndex(expr->LiteralFeedbackSlot()); |
| 5105 HValue* index_value = Add<HConstant>(index); |
5102 if (!expr->pretenure()) { | 5106 if (!expr->pretenure()) { |
5103 FastNewClosureStub stub(isolate()); | 5107 FastNewClosureStub stub(isolate()); |
5104 FastNewClosureDescriptor descriptor(isolate()); | 5108 FastNewClosureDescriptor descriptor(isolate()); |
5105 HValue* values[] = {shared_info_value}; | |
5106 HConstant* stub_value = Add<HConstant>(stub.GetCode()); | 5109 HConstant* stub_value = Add<HConstant>(stub.GetCode()); |
| 5110 // Retrieve the literals array from the vector. |
| 5111 HValue* values[] = {shared_info_value, vector_value, index_value}; |
5107 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, | 5112 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
5108 ArrayVector(values)); | 5113 ArrayVector(values)); |
5109 } else { | 5114 } else { |
5110 Add<HPushArguments>(shared_info_value); | 5115 Add<HPushArguments>(shared_info_value); |
| 5116 Add<HPushArguments>(vector_value); |
| 5117 Add<HPushArguments>(index_value); |
5111 Runtime::FunctionId function_id = | 5118 Runtime::FunctionId function_id = |
5112 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; | 5119 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; |
5113 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 1); | 5120 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 3); |
5114 } | 5121 } |
5115 return ast_context()->ReturnInstruction(instr, expr->id()); | 5122 return ast_context()->ReturnInstruction(instr, expr->id()); |
5116 } | 5123 } |
5117 | 5124 |
5118 | 5125 |
5119 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { | 5126 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { |
5120 DCHECK(!HasStackOverflow()); | 5127 DCHECK(!HasStackOverflow()); |
5121 DCHECK(current_block() != NULL); | 5128 DCHECK(current_block() != NULL); |
5122 DCHECK(current_block()->HasPredecessor()); | 5129 DCHECK(current_block()->HasPredecessor()); |
5123 return Bailout(kClassLiteral); | 5130 return Bailout(kClassLiteral); |
(...skipping 7905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13029 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13036 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13030 } | 13037 } |
13031 | 13038 |
13032 #ifdef DEBUG | 13039 #ifdef DEBUG |
13033 graph_->Verify(false); // No full verify. | 13040 graph_->Verify(false); // No full verify. |
13034 #endif | 13041 #endif |
13035 } | 13042 } |
13036 | 13043 |
13037 } // namespace internal | 13044 } // namespace internal |
13038 } // namespace v8 | 13045 } // namespace v8 |
OLD | NEW |