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

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

Issue 1622493002: [stubs] Introduce ToNameStub to implement %_ToName. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix BuildNumberToString type in Crankshaft. Created 4 years, 11 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/crankshaft/hydrogen.h ('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 12273 matching lines...) Expand 10 before | Expand all | Expand 10 after
12284 Add<HPushArguments>(input); 12284 Add<HPushArguments>(input);
12285 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToInteger), 1)); 12285 Push(Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kToInteger), 1));
12286 Add<HSimulate>(call->id(), FIXED_SIMULATE); 12286 Add<HSimulate>(call->id(), FIXED_SIMULATE);
12287 } 12287 }
12288 if_inputissmi.End(); 12288 if_inputissmi.End();
12289 return ast_context()->ReturnValue(Pop()); 12289 return ast_context()->ReturnValue(Pop());
12290 } 12290 }
12291 } 12291 }
12292 12292
12293 12293
12294 void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) {
12295 DCHECK_EQ(1, call->arguments()->length());
12296 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12297 HValue* input = Pop();
12298 if (input->type().IsSmi()) {
12299 HValue* result = BuildNumberToString(input, Type::SignedSmall(zone()));
12300 return ast_context()->ReturnValue(result);
12301 } else if (input->type().IsTaggedNumber()) {
12302 HValue* result = BuildNumberToString(input, Type::Number(zone()));
12303 return ast_context()->ReturnValue(result);
12304 } else if (input->type().IsString()) {
12305 return ast_context()->ReturnValue(input);
12306 } else {
12307 Callable callable = CodeFactory::ToName(isolate());
12308 HValue* stub = Add<HConstant>(callable.code());
12309 HValue* values[] = {context(), input};
12310 HInstruction* result =
12311 New<HCallWithDescriptor>(stub, 0, callable.descriptor(),
12312 Vector<HValue*>(values, arraysize(values)));
12313 return ast_context()->ReturnInstruction(result, call->id());
12314 }
12315 }
12316
12317
12294 void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) { 12318 void HOptimizedGraphBuilder::GenerateToObject(CallRuntime* call) {
12295 DCHECK_EQ(1, call->arguments()->length()); 12319 DCHECK_EQ(1, call->arguments()->length());
12296 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12320 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12297 HValue* value = Pop(); 12321 HValue* value = Pop();
12298 HValue* result = BuildToObject(value); 12322 HValue* result = BuildToObject(value);
12299 return ast_context()->ReturnValue(result); 12323 return ast_context()->ReturnValue(result);
12300 } 12324 }
12301 12325
12302 12326
12303 void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) { 12327 void HOptimizedGraphBuilder::GenerateToString(CallRuntime* call) {
12304 DCHECK_EQ(1, call->arguments()->length()); 12328 DCHECK_EQ(1, call->arguments()->length());
12305 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 12329 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
12306 Callable callable = CodeFactory::ToString(isolate());
12307 HValue* input = Pop(); 12330 HValue* input = Pop();
12308 if (input->type().IsString()) { 12331 if (input->type().IsString()) {
12309 return ast_context()->ReturnValue(input); 12332 return ast_context()->ReturnValue(input);
12310 } else { 12333 } else {
12334 Callable callable = CodeFactory::ToString(isolate());
12311 HValue* stub = Add<HConstant>(callable.code()); 12335 HValue* stub = Add<HConstant>(callable.code());
12312 HValue* values[] = {context(), input}; 12336 HValue* values[] = {context(), input};
12313 HInstruction* result = 12337 HInstruction* result =
12314 New<HCallWithDescriptor>(stub, 0, callable.descriptor(), 12338 New<HCallWithDescriptor>(stub, 0, callable.descriptor(),
12315 Vector<HValue*>(values, arraysize(values))); 12339 Vector<HValue*>(values, arraysize(values)));
12316 return ast_context()->ReturnInstruction(result, call->id()); 12340 return ast_context()->ReturnInstruction(result, call->id());
12317 } 12341 }
12318 } 12342 }
12319 12343
12320 12344
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
13616 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13640 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13617 } 13641 }
13618 13642
13619 #ifdef DEBUG 13643 #ifdef DEBUG
13620 graph_->Verify(false); // No full verify. 13644 graph_->Verify(false); // No full verify.
13621 #endif 13645 #endif
13622 } 13646 }
13623 13647
13624 } // namespace internal 13648 } // namespace internal
13625 } // namespace v8 13649 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698