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

Side by Side Diff: src/hydrogen.cc

Issue 77553005: Convert constant numbers at compile time. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment. Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 1534
1535 return BuildUncheckedDictionaryElementLoadHelper(elements, key, 1535 return BuildUncheckedDictionaryElementLoadHelper(elements, key,
1536 hash, mask, 0); 1536 hash, mask, 0);
1537 } 1537 }
1538 1538
1539 1539
1540 HValue* HGraphBuilder::BuildNumberToString(HValue* object, 1540 HValue* HGraphBuilder::BuildNumberToString(HValue* object,
1541 Handle<Type> type) { 1541 Handle<Type> type) {
1542 NoObservableSideEffectsScope scope(this); 1542 NoObservableSideEffectsScope scope(this);
1543 1543
1544 // Convert constant numbers at compile time.
1545 if (object->IsConstant() && HConstant::cast(object)->HasNumberValue()) {
1546 Handle<Object> number = HConstant::cast(object)->handle(isolate());
1547 Handle<String> result = isolate()->factory()->NumberToString(number);
1548 return Add<HConstant>(result);
1549 }
1550
1544 // Create a joinable continuation. 1551 // Create a joinable continuation.
1545 HIfContinuation found(graph()->CreateBasicBlock(), 1552 HIfContinuation found(graph()->CreateBasicBlock(),
1546 graph()->CreateBasicBlock()); 1553 graph()->CreateBasicBlock());
1547 1554
1548 // Load the number string cache. 1555 // Load the number string cache.
1549 HValue* number_string_cache = 1556 HValue* number_string_cache =
1550 Add<HLoadRoot>(Heap::kNumberStringCacheRootIndex); 1557 Add<HLoadRoot>(Heap::kNumberStringCacheRootIndex);
1551 1558
1552 // Make the hash mask from the length of the number string cache. It 1559 // Make the hash mask from the length of the number string cache. It
1553 // contains two elements (number and string) for each cache entry. 1560 // contains two elements (number and string) for each cache entry.
(...skipping 9079 matching lines...) Expand 10 before | Expand all | Expand 10 after
10633 if (ShouldProduceTraceOutput()) { 10640 if (ShouldProduceTraceOutput()) {
10634 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10641 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10635 } 10642 }
10636 10643
10637 #ifdef DEBUG 10644 #ifdef DEBUG
10638 graph_->Verify(false); // No full verify. 10645 graph_->Verify(false); // No full verify.
10639 #endif 10646 #endif
10640 } 10647 }
10641 10648
10642 } } // namespace v8::internal 10649 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698