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); | |
5058 if (!expr->pretenure()) { | 5054 if (!expr->pretenure()) { |
5059 FastNewClosureStub stub(isolate()); | 5055 FastNewClosureStub stub(isolate()); |
5060 FastNewClosureDescriptor descriptor(isolate()); | 5056 FastNewClosureDescriptor descriptor(isolate()); |
| 5057 HValue* values[] = {shared_info_value}; |
5061 HConstant* stub_value = Add<HConstant>(stub.GetCode()); | 5058 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}; | |
5064 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, | 5059 instr = New<HCallWithDescriptor>(stub_value, 0, descriptor, |
5065 ArrayVector(values)); | 5060 ArrayVector(values)); |
5066 } else { | 5061 } else { |
5067 Add<HPushArguments>(shared_info_value); | 5062 Add<HPushArguments>(shared_info_value); |
5068 Add<HPushArguments>(vector_value); | |
5069 Add<HPushArguments>(index_value); | |
5070 Runtime::FunctionId function_id = | 5063 Runtime::FunctionId function_id = |
5071 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; | 5064 expr->pretenure() ? Runtime::kNewClosure_Tenured : Runtime::kNewClosure; |
5072 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 3); | 5065 instr = New<HCallRuntime>(Runtime::FunctionForId(function_id), 1); |
5073 } | 5066 } |
5074 return ast_context()->ReturnInstruction(instr, expr->id()); | 5067 return ast_context()->ReturnInstruction(instr, expr->id()); |
5075 } | 5068 } |
5076 | 5069 |
5077 | 5070 |
5078 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { | 5071 void HOptimizedGraphBuilder::VisitClassLiteral(ClassLiteral* lit) { |
5079 DCHECK(!HasStackOverflow()); | 5072 DCHECK(!HasStackOverflow()); |
5080 DCHECK(current_block() != NULL); | 5073 DCHECK(current_block() != NULL); |
5081 DCHECK(current_block()->HasPredecessor()); | 5074 DCHECK(current_block()->HasPredecessor()); |
5082 return Bailout(kClassLiteral); | 5075 return Bailout(kClassLiteral); |
(...skipping 7935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13018 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13011 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13019 } | 13012 } |
13020 | 13013 |
13021 #ifdef DEBUG | 13014 #ifdef DEBUG |
13022 graph_->Verify(false); // No full verify. | 13015 graph_->Verify(false); // No full verify. |
13023 #endif | 13016 #endif |
13024 } | 13017 } |
13025 | 13018 |
13026 } // namespace internal | 13019 } // namespace internal |
13027 } // namespace v8 | 13020 } // namespace v8 |
OLD | NEW |