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 12110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12121 HValue* to = Pop(); | 12121 HValue* to = Pop(); |
12122 HValue* from = Pop(); | 12122 HValue* from = Pop(); |
12123 HValue* string = Pop(); | 12123 HValue* string = Pop(); |
12124 HValue* values[] = {string, from, to}; | 12124 HValue* values[] = {string, from, to}; |
12125 HInstruction* result = New<HCallWithDescriptor>( | 12125 HInstruction* result = New<HCallWithDescriptor>( |
12126 stub, 0, callable.descriptor(), ArrayVector(values)); | 12126 stub, 0, callable.descriptor(), ArrayVector(values)); |
12127 result->set_type(HType::String()); | 12127 result->set_type(HType::String()); |
12128 return ast_context()->ReturnInstruction(result, call->id()); | 12128 return ast_context()->ReturnInstruction(result, call->id()); |
12129 } | 12129 } |
12130 | 12130 |
12131 // Support for direct calls from JavaScript to native RegExp code. | |
12132 void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) { | |
12133 DCHECK_EQ(4, call->arguments()->length()); | |
12134 CHECK_ALIVE(VisitExpressions(call->arguments())); | |
12135 Callable callable = CodeFactory::RegExpExec(isolate()); | |
12136 HValue* last_match_info = Pop(); | |
12137 HValue* index = Pop(); | |
12138 HValue* subject = Pop(); | |
12139 HValue* regexp_object = Pop(); | |
12140 HValue* stub = Add<HConstant>(callable.code()); | |
12141 HValue* values[] = {regexp_object, subject, index, last_match_info}; | |
12142 HInstruction* result = New<HCallWithDescriptor>( | |
12143 stub, 0, callable.descriptor(), ArrayVector(values)); | |
12144 return ast_context()->ReturnInstruction(result, call->id()); | |
12145 } | |
12146 | |
12147 | |
12148 // Fast support for number to string. | |
12149 void HOptimizedGraphBuilder::GenerateNumberToString(CallRuntime* call) { | |
12150 DCHECK_EQ(1, call->arguments()->length()); | |
12151 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
12152 HValue* number = Pop(); | |
12153 HValue* result = BuildNumberToString(number, AstType::Any()); | |
12154 return ast_context()->ReturnValue(result); | |
12155 } | |
12156 | |
12157 | 12131 |
12158 // Fast support for calls. | 12132 // Fast support for calls. |
12159 void HOptimizedGraphBuilder::GenerateCall(CallRuntime* call) { | 12133 void HOptimizedGraphBuilder::GenerateCall(CallRuntime* call) { |
12160 DCHECK_LE(2, call->arguments()->length()); | 12134 DCHECK_LE(2, call->arguments()->length()); |
12161 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12135 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12162 CallTrampolineDescriptor descriptor(isolate()); | 12136 CallTrampolineDescriptor descriptor(isolate()); |
12163 PushArgumentsFromEnvironment(call->arguments()->length() - 1); | 12137 PushArgumentsFromEnvironment(call->arguments()->length() - 1); |
12164 HValue* trampoline = Add<HConstant>(isolate()->builtins()->Call()); | 12138 HValue* trampoline = Add<HConstant>(isolate()->builtins()->Call()); |
12165 HValue* target = Pop(); | 12139 HValue* target = Pop(); |
12166 HValue* values[] = {target, Add<HConstant>(call->arguments()->length() - 2)}; | 12140 HValue* values[] = {target, Add<HConstant>(call->arguments()->length() - 2)}; |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13025 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12999 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13026 } | 13000 } |
13027 | 13001 |
13028 #ifdef DEBUG | 13002 #ifdef DEBUG |
13029 graph_->Verify(false); // No full verify. | 13003 graph_->Verify(false); // No full verify. |
13030 #endif | 13004 #endif |
13031 } | 13005 } |
13032 | 13006 |
13033 } // namespace internal | 13007 } // namespace internal |
13034 } // namespace v8 | 13008 } // namespace v8 |
OLD | NEW |