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 <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 12287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12298 DCHECK(call->arguments()->length() == 2); | 12298 DCHECK(call->arguments()->length() == 2); |
12299 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 12299 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
12300 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 12300 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
12301 HValue* index = Pop(); | 12301 HValue* index = Pop(); |
12302 HValue* string = Pop(); | 12302 HValue* string = Pop(); |
12303 HInstruction* result = BuildStringCharCodeAt(string, index); | 12303 HInstruction* result = BuildStringCharCodeAt(string, index); |
12304 return ast_context()->ReturnInstruction(result, call->id()); | 12304 return ast_context()->ReturnInstruction(result, call->id()); |
12305 } | 12305 } |
12306 | 12306 |
12307 | 12307 |
12308 // Fast support for string.charAt(n) and string[n]. | |
12309 void HOptimizedGraphBuilder::GenerateStringCharFromCode(CallRuntime* call) { | |
12310 DCHECK(call->arguments()->length() == 1); | |
12311 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
12312 HValue* char_code = Pop(); | |
12313 HInstruction* result = NewUncasted<HStringCharFromCode>(char_code); | |
12314 return ast_context()->ReturnInstruction(result, call->id()); | |
12315 } | |
12316 | |
12317 | |
12318 // Fast support for SubString. | 12308 // Fast support for SubString. |
12319 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { | 12309 void HOptimizedGraphBuilder::GenerateSubString(CallRuntime* call) { |
12320 DCHECK_EQ(3, call->arguments()->length()); | 12310 DCHECK_EQ(3, call->arguments()->length()); |
12321 CHECK_ALIVE(VisitExpressions(call->arguments())); | 12311 CHECK_ALIVE(VisitExpressions(call->arguments())); |
12322 Callable callable = CodeFactory::SubString(isolate()); | 12312 Callable callable = CodeFactory::SubString(isolate()); |
12323 HValue* stub = Add<HConstant>(callable.code()); | 12313 HValue* stub = Add<HConstant>(callable.code()); |
12324 HValue* to = Pop(); | 12314 HValue* to = Pop(); |
12325 HValue* from = Pop(); | 12315 HValue* from = Pop(); |
12326 HValue* string = Pop(); | 12316 HValue* string = Pop(); |
12327 HValue* values[] = {context(), string, from, to}; | 12317 HValue* values[] = {context(), string, from, to}; |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13288 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13278 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13289 } | 13279 } |
13290 | 13280 |
13291 #ifdef DEBUG | 13281 #ifdef DEBUG |
13292 graph_->Verify(false); // No full verify. | 13282 graph_->Verify(false); // No full verify. |
13293 #endif | 13283 #endif |
13294 } | 13284 } |
13295 | 13285 |
13296 } // namespace internal | 13286 } // namespace internal |
13297 } // namespace v8 | 13287 } // namespace v8 |
OLD | NEW |