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 12524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12535 HInstruction* result = NewUncasted<HStringCharFromCode>(char_code); | 12535 HInstruction* result = NewUncasted<HStringCharFromCode>(char_code); |
12536 return ast_context()->ReturnInstruction(result, call->id()); | 12536 return ast_context()->ReturnInstruction(result, call->id()); |
12537 } | 12537 } |
12538 | 12538 |
12539 | 12539 |
12540 // Fast support for SubString. | 12540 // Fast support for SubString. |
12541 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { | 12541 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { |
12542 DCHECK_EQ(3, call->arguments()->length()); | 12542 DCHECK_EQ(3, call->arguments()->length()); |
12543 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12543 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12544 PushArgumentsFromEnvironment(call->arguments()->length()); | 12544 PushArgumentsFromEnvironment(call->arguments()->length()); |
12545 HCallStub* result = New<HCallStub>(CodeStub::SubString, 3); | 12545 Callable callable = CodeFactory::SubString(isolate()); |
| 12546 HValue* stub = Add<HConstant>(callable.code()); |
| 12547 HValue* values[] = {context()}; |
| 12548 HInstruction* result = New<HCallWithDescriptor>( |
| 12549 stub, call->arguments()->length(), callable.descriptor(), |
| 12550 Vector<HValue*>(values, arraysize(values))); |
| 12551 result->set_type(HType::String()); |
12546 return ast_context()->ReturnInstruction(result, call->id()); | 12552 return ast_context()->ReturnInstruction(result, call->id()); |
12547 } | 12553 } |
12548 | 12554 |
12549 | 12555 |
12550 // Support for direct calls from JavaScript to native RegExp code. | 12556 // Support for direct calls from JavaScript to native RegExp code. |
12551 void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) { | 12557 void HOptimizedGraphBuilder::GenerateRegExpExec(CallRuntime* call) { |
12552 DCHECK_EQ(4, call->arguments()->length()); | 12558 DCHECK_EQ(4, call->arguments()->length()); |
12553 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12559 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12554 PushArgumentsFromEnvironment(call->arguments()->length()); | 12560 PushArgumentsFromEnvironment(call->arguments()->length()); |
12555 HCallStub* result = New<HCallStub>(CodeStub::RegExpExec, 4); | 12561 Callable callable = CodeFactory::RegExpExec(isolate()); |
| 12562 HValue* stub = Add<HConstant>(callable.code()); |
| 12563 HValue* values[] = {context()}; |
| 12564 HInstruction* result = New<HCallWithDescriptor>( |
| 12565 stub, call->arguments()->length(), callable.descriptor(), |
| 12566 Vector<HValue*>(values, arraysize(values))); |
12556 return ast_context()->ReturnInstruction(result, call->id()); | 12567 return ast_context()->ReturnInstruction(result, call->id()); |
12557 } | 12568 } |
12558 | 12569 |
12559 | 12570 |
12560 void HOptimizedGraphBuilder::GenerateRegExpFlags(CallRuntime* call) { | 12571 void HOptimizedGraphBuilder::GenerateRegExpFlags(CallRuntime* call) { |
12561 DCHECK_EQ(1, call->arguments()->length()); | 12572 DCHECK_EQ(1, call->arguments()->length()); |
12562 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12573 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12563 HValue* regexp = Pop(); | 12574 HValue* regexp = Pop(); |
12564 HInstruction* result = | 12575 HInstruction* result = |
12565 New<HLoadNamedField>(regexp, nullptr, HObjectAccess::ForJSRegExpFlags()); | 12576 New<HLoadNamedField>(regexp, nullptr, HObjectAccess::ForJSRegExpFlags()); |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13545 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13556 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13546 } | 13557 } |
13547 | 13558 |
13548 #ifdef DEBUG | 13559 #ifdef DEBUG |
13549 graph_->Verify(false); // No full verify. | 13560 graph_->Verify(false); // No full verify. |
13550 #endif | 13561 #endif |
13551 } | 13562 } |
13552 | 13563 |
13553 } // namespace internal | 13564 } // namespace internal |
13554 } // namespace v8 | 13565 } // namespace v8 |
OLD | NEW |