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 12649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12660 // Fast support for string.charAt(n) and string[n]. | 12660 // Fast support for string.charAt(n) and string[n]. |
12661 void HOptimizedGraphBuilder::GenerateStringCharFromCode(CallRuntime* call) { | 12661 void HOptimizedGraphBuilder::GenerateStringCharFromCode(CallRuntime* call) { |
12662 DCHECK(call->arguments()->length() == 1); | 12662 DCHECK(call->arguments()->length() == 1); |
12663 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12663 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12664 HValue* char_code = Pop(); | 12664 HValue* char_code = Pop(); |
12665 HInstruction* result = NewUncasted<HStringCharFromCode>(char_code); | 12665 HInstruction* result = NewUncasted<HStringCharFromCode>(char_code); |
12666 return ast_context()->ReturnInstruction(result, call->id()); | 12666 return ast_context()->ReturnInstruction(result, call->id()); |
12667 } | 12667 } |
12668 | 12668 |
12669 | 12669 |
12670 // Fast support for string.charAt(n) and string[n]. | |
12671 void HOptimizedGraphBuilder::GenerateStringCharAt(CallRuntime* call) { | |
12672 DCHECK(call->arguments()->length() == 2); | |
12673 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
12674 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | |
12675 HValue* index = Pop(); | |
12676 HValue* string = Pop(); | |
12677 HInstruction* char_code = BuildStringCharCodeAt(string, index); | |
12678 AddInstruction(char_code); | |
12679 HInstruction* result = NewUncasted<HStringCharFromCode>(char_code); | |
12680 return ast_context()->ReturnInstruction(result, call->id()); | |
12681 } | |
12682 | |
12683 | |
12684 // Fast support for SubString. | 12670 // Fast support for SubString. |
12685 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { | 12671 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { |
12686 DCHECK_EQ(3, call->arguments()->length()); | 12672 DCHECK_EQ(3, call->arguments()->length()); |
12687 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12673 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12688 PushArgumentsFromEnvironment(call->arguments()->length()); | 12674 PushArgumentsFromEnvironment(call->arguments()->length()); |
12689 Callable callable = CodeFactory::SubString(isolate()); | 12675 Callable callable = CodeFactory::SubString(isolate()); |
12690 HValue* stub = Add<HConstant>(callable.code()); | 12676 HValue* stub = Add<HConstant>(callable.code()); |
12691 HValue* values[] = {context()}; | 12677 HValue* values[] = {context()}; |
12692 HInstruction* result = | 12678 HInstruction* result = |
12693 New<HCallWithDescriptor>(stub, call->arguments()->length(), | 12679 New<HCallWithDescriptor>(stub, call->arguments()->length(), |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13697 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13683 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13698 } | 13684 } |
13699 | 13685 |
13700 #ifdef DEBUG | 13686 #ifdef DEBUG |
13701 graph_->Verify(false); // No full verify. | 13687 graph_->Verify(false); // No full verify. |
13702 #endif | 13688 #endif |
13703 } | 13689 } |
13704 | 13690 |
13705 } // namespace internal | 13691 } // namespace internal |
13706 } // namespace v8 | 13692 } // namespace v8 |
OLD | NEW |