| 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/hydrogen.h" | 5 #include "src/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-numbering.h" | 10 #include "src/ast-numbering.h" |
| (...skipping 12459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12470 // Fast support for number to string. | 12470 // Fast support for number to string. |
| 12471 void HOptimizedGraphBuilder::GenerateNumberToString(CallRuntime* call) { | 12471 void HOptimizedGraphBuilder::GenerateNumberToString(CallRuntime* call) { |
| 12472 DCHECK_EQ(1, call->arguments()->length()); | 12472 DCHECK_EQ(1, call->arguments()->length()); |
| 12473 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12473 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12474 HValue* number = Pop(); | 12474 HValue* number = Pop(); |
| 12475 HValue* result = BuildNumberToString(number, Type::Any(zone())); | 12475 HValue* result = BuildNumberToString(number, Type::Any(zone())); |
| 12476 return ast_context()->ReturnValue(result); | 12476 return ast_context()->ReturnValue(result); |
| 12477 } | 12477 } |
| 12478 | 12478 |
| 12479 | 12479 |
| 12480 // Fast support for calls. |
| 12481 void HOptimizedGraphBuilder::GenerateCall(CallRuntime* call) { |
| 12482 DCHECK_LE(2, call->arguments()->length()); |
| 12483 CHECK_ALIVE(VisitExpressions(call->arguments())); |
| 12484 CallTrampolineDescriptor descriptor(isolate()); |
| 12485 PushArgumentsFromEnvironment(call->arguments()->length() - 1); |
| 12486 HValue* trampoline = Add<HConstant>(isolate()->builtins()->Call()); |
| 12487 HValue* target = Pop(); |
| 12488 HValue* values[] = {context(), target, |
| 12489 Add<HConstant>(call->arguments()->length() - 2)}; |
| 12490 HInstruction* result = New<HCallWithDescriptor>( |
| 12491 trampoline, call->arguments()->length() - 1, descriptor, |
| 12492 Vector<HValue*>(values, arraysize(values))); |
| 12493 return ast_context()->ReturnInstruction(result, call->id()); |
| 12494 } |
| 12495 |
| 12496 |
| 12480 // Fast call for custom callbacks. | 12497 // Fast call for custom callbacks. |
| 12481 void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) { | 12498 void HOptimizedGraphBuilder::GenerateCallFunction(CallRuntime* call) { |
| 12482 // 1 ~ The function to call is not itself an argument to the call. | 12499 // 1 ~ The function to call is not itself an argument to the call. |
| 12483 int arg_count = call->arguments()->length() - 1; | 12500 int arg_count = call->arguments()->length() - 1; |
| 12484 DCHECK(arg_count >= 1); // There's always at least a receiver. | 12501 DCHECK(arg_count >= 1); // There's always at least a receiver. |
| 12485 | 12502 |
| 12486 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12503 CHECK_ALIVE(VisitExpressions(call->arguments())); |
| 12487 // The function is the last argument | 12504 // The function is the last argument |
| 12488 HValue* function = Pop(); | 12505 HValue* function = Pop(); |
| 12489 // Push the arguments to the stack | 12506 // Push the arguments to the stack |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13444 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13461 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13445 } | 13462 } |
| 13446 | 13463 |
| 13447 #ifdef DEBUG | 13464 #ifdef DEBUG |
| 13448 graph_->Verify(false); // No full verify. | 13465 graph_->Verify(false); // No full verify. |
| 13449 #endif | 13466 #endif |
| 13450 } | 13467 } |
| 13451 | 13468 |
| 13452 } // namespace internal | 13469 } // namespace internal |
| 13453 } // namespace v8 | 13470 } // namespace v8 |
| OLD | NEW |