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 10459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10470 view, nullptr, | 10470 view, nullptr, |
10471 FieldIndex::ForInObjectOffset(JSTypedArray::kLengthOffset))); | 10471 FieldIndex::ForInObjectOffset(JSTypedArray::kLengthOffset))); |
10472 } | 10472 } |
10473 | 10473 |
10474 | 10474 |
10475 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { | 10475 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
10476 DCHECK(!HasStackOverflow()); | 10476 DCHECK(!HasStackOverflow()); |
10477 DCHECK(current_block() != NULL); | 10477 DCHECK(current_block() != NULL); |
10478 DCHECK(current_block()->HasPredecessor()); | 10478 DCHECK(current_block()->HasPredecessor()); |
10479 if (expr->is_jsruntime()) { | 10479 if (expr->is_jsruntime()) { |
10480 return Bailout(kCallToAJavaScriptRuntimeFunction); | 10480 // The callee and the receiver both have to be pushed onto the operand stack |
| 10481 // before arguments are being evaluated. |
| 10482 HValue* function = AddLoadJSBuiltin(expr->context_index()); |
| 10483 HValue* receiver = graph()->GetConstantUndefined(); |
| 10484 Push(function); |
| 10485 Push(receiver); |
| 10486 |
| 10487 int argument_count = expr->arguments()->length() + 1; // Count receiver. |
| 10488 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
| 10489 PushArgumentsFromEnvironment(argument_count); |
| 10490 HInstruction* call = NewCallFunction(function, argument_count, |
| 10491 ConvertReceiverMode::kNullOrUndefined, |
| 10492 TailCallMode::kDisallow); |
| 10493 Drop(1); // Function |
| 10494 return ast_context()->ReturnInstruction(call, expr->id()); |
10481 } | 10495 } |
10482 | 10496 |
10483 const Runtime::Function* function = expr->function(); | 10497 const Runtime::Function* function = expr->function(); |
10484 DCHECK(function != NULL); | 10498 DCHECK(function != NULL); |
10485 switch (function->function_id) { | 10499 switch (function->function_id) { |
10486 #define CALL_INTRINSIC_GENERATOR(Name) \ | 10500 #define CALL_INTRINSIC_GENERATOR(Name) \ |
10487 case Runtime::kInline##Name: \ | 10501 case Runtime::kInline##Name: \ |
10488 return Generate##Name(expr); | 10502 return Generate##Name(expr); |
10489 | 10503 |
10490 FOR_EACH_HYDROGEN_INTRINSIC(CALL_INTRINSIC_GENERATOR) | 10504 FOR_EACH_HYDROGEN_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
(...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13495 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13509 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13496 } | 13510 } |
13497 | 13511 |
13498 #ifdef DEBUG | 13512 #ifdef DEBUG |
13499 graph_->Verify(false); // No full verify. | 13513 graph_->Verify(false); // No full verify. |
13500 #endif | 13514 #endif |
13501 } | 13515 } |
13502 | 13516 |
13503 } // namespace internal | 13517 } // namespace internal |
13504 } // namespace v8 | 13518 } // namespace v8 |
OLD | NEW |