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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 12294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12305 Callable callable = CodeFactory::ToInteger(isolate()); | 12305 Callable callable = CodeFactory::ToInteger(isolate()); |
12306 HValue* stub = Add<HConstant>(callable.code()); | 12306 HValue* stub = Add<HConstant>(callable.code()); |
12307 HValue* values[] = {context(), input}; | 12307 HValue* values[] = {context(), input}; |
12308 HInstruction* result = New<HCallWithDescriptor>( | 12308 HInstruction* result = New<HCallWithDescriptor>( |
12309 stub, 0, callable.descriptor(), ArrayVector(values)); | 12309 stub, 0, callable.descriptor(), ArrayVector(values)); |
12310 return ast_context()->ReturnInstruction(result, call->id()); | 12310 return ast_context()->ReturnInstruction(result, call->id()); |
12311 } | 12311 } |
12312 } | 12312 } |
12313 | 12313 |
12314 | 12314 |
12315 void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) { | |
12316 DCHECK_EQ(1, call->arguments()->length()); | |
12317 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
12318 HValue* input = Pop(); | |
12319 if (input->type().IsSmi()) { | |
12320 HValue* result = BuildNumberToString(input, Type::SignedSmall()); | |
12321 return ast_context()->ReturnValue(result); | |
12322 } else if (input->type().IsTaggedNumber()) { | |
12323 HValue* result = BuildNumberToString(input, Type::Number()); | |
12324 return ast_context()->ReturnValue(result); | |
12325 } else if (input->type().IsString()) { | |
12326 return ast_context()->ReturnValue(input); | |
12327 } else { | |
12328 Callable callable = CodeFactory::ToName(isolate()); | |
12329 HValue* stub = Add<HConstant>(callable.code()); | |
12330 HValue* values[] = {context(), input}; | |
12331 HInstruction* result = New<HCallWithDescriptor>( | |
12332 stub, 0, callable.descriptor(), ArrayVector(values)); | |
12333 return ast_context()->ReturnInstruction(result, call->id()); | |
12334 } | |
12335 } | |
12336 | |
12337 | |
12338 void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) { | 12315 void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) { |
12339 DCHECK_EQ(1, call->arguments()->length()); | 12316 DCHECK_EQ(1, call->arguments()->length()); |
12340 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12317 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12341 HValue* value = Pop(); | 12318 HValue* value = Pop(); |
12342 HValue* result = BuildToObject(value); | 12319 HValue* result = BuildToObject(value); |
12343 return ast_context()->ReturnValue(result); | 12320 return ast_context()->ReturnValue(result); |
12344 } | 12321 } |
12345 | 12322 |
12346 | 12323 |
12347 void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) { | 12324 void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) { |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13429 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13406 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13430 } | 13407 } |
13431 | 13408 |
13432 #ifdef DEBUG | 13409 #ifdef DEBUG |
13433 graph_->Verify(false); // No full verify. | 13410 graph_->Verify(false); // No full verify. |
13434 #endif | 13411 #endif |
13435 } | 13412 } |
13436 | 13413 |
13437 } // namespace internal | 13414 } // namespace internal |
13438 } // namespace v8 | 13415 } // namespace v8 |
OLD | NEW |