Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 1846683006: [stubs] Introduce ToIntegerStub and unify the handling of %_ToInteger. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12265 matching lines...) Expand 10 before | Expand all | Expand 10 after
12276 } 12276 }
12277 12277
12278 12278
12279 void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) { 12279 void HOptimizedGraphBuilder::GenerateToInteger(CallRuntime* call) {
12280 DCHECK_EQ(1, call->arguments()->length()); 12280 DCHECK_EQ(1, call->arguments()->length());
12281 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12281 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12282 HValue* input = Pop(); 12282 HValue* input = Pop();
12283 if (input->type().IsSmi()) { 12283 if (input->type().IsSmi()) {
12284 return ast_context()->ReturnValue(input); 12284 return ast_context()->ReturnValue(input);
12285 } else { 12285 } else {
12286 IfBuilder if_inputissmi(this); 12286 Callable callable = CodeFactory::ToInteger(isolate());
12287 if_inputissmi.If<HIsSmiAndBranch>(input); 12287 HValue* stub = Add<HConstant>(callable.code());
12288 if_inputissmi.Then(); 12288 HValue* values[] = {context(), input};
12289 { 12289 HInstruction* result =
12290 // Return the input value. 12290 New<HCallWithDescriptor>(stub, 0, callable.descriptor(),
12291 Push(input); 12291 Vector<HValue*>(values, arraysize(values)));
12292 Add<HSimulate>(call->id(), FIXED_SIMULATE); 12292 return ast_context()->ReturnInstruction(result, call->id());
12293 }
12294 if_inputissmi.Else();
12295 {
12296 Add<HPushArguments>(input);
12297 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToInteger), 1));
12298 Add<HSimulate>(call->id(), FIXED_SIMULATE);
12299 }
12300 if_inputissmi.End();
12301 return ast_context()->ReturnValue(Pop());
12302 } 12293 }
12303 } 12294 }
12304 12295
12305 12296
12306 void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) { 12297 void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) {
12307 DCHECK_EQ(1, call->arguments()->length()); 12298 DCHECK_EQ(1, call->arguments()->length());
12308 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12299 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12309 HValue* input = Pop(); 12300 HValue* input = Pop();
12310 if (input->type().IsSmi()) { 12301 if (input->type().IsSmi()) {
12311 HValue* result = BuildNumberToString(input, Type::SignedSmall()); 12302 HValue* result = BuildNumberToString(input, Type::SignedSmall());
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
13571 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13562 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13572 } 13563 }
13573 13564
13574 #ifdef DEBUG 13565 #ifdef DEBUG
13575 graph_->Verify(false); // No full verify. 13566 graph_->Verify(false); // No full verify.
13576 #endif 13567 #endif
13577 } 13568 }
13578 13569
13579 } // namespace internal 13570 } // namespace internal
13580 } // namespace v8 13571 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-intrinsic-lowering.cc ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698