Convert constant numbers at compile time.

TEST=mjsunit/number-tostring
R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/77553005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17917 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2013-11-20 12:35:21 +00:00
parent bd09937300
commit 4c4d911cde

View File

@ -1555,6 +1555,13 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object,
Handle<Type> type) {
NoObservableSideEffectsScope scope(this);
// Convert constant numbers at compile time.
if (object->IsConstant() && HConstant::cast(object)->HasNumberValue()) {
Handle<Object> number = HConstant::cast(object)->handle(isolate());
Handle<String> result = isolate()->factory()->NumberToString(number);
return Add<HConstant>(result);
}
// Create a joinable continuation.
HIfContinuation found(graph()->CreateBasicBlock(),
graph()->CreateBasicBlock());