Commit 4c4d911c authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

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
parent bd099373
...@@ -1555,6 +1555,13 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object, ...@@ -1555,6 +1555,13 @@ HValue* HGraphBuilder::BuildNumberToString(HValue* object,
Handle<Type> type) { Handle<Type> type) {
NoObservableSideEffectsScope scope(this); 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. // Create a joinable continuation.
HIfContinuation found(graph()->CreateBasicBlock(), HIfContinuation found(graph()->CreateBasicBlock(),
graph()->CreateBasicBlock()); graph()->CreateBasicBlock());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment